| Index: base/thread_main_task_runner.h
|
| diff --git a/base/thread_main_task_runner.h b/base/thread_main_task_runner.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8a65cc9688d70d944e7a1cbd9abc6741a474035c
|
| --- /dev/null
|
| +++ b/base/thread_main_task_runner.h
|
| @@ -0,0 +1,39 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BASE_THREAD_MAIN_TASK_RUNNER_H_
|
| +#define BASE_THREAD_MAIN_TASK_RUNNER_H_
|
| +#pragma once
|
| +
|
| +#include "base/base_export.h"
|
| +#include "base/single_thread_task_runner.h"
|
| +
|
| +namespace base {
|
| +
|
| +// ThreadMainTaskRunner is a SingleThreadTaskRunner that is used for
|
| +// the main task runner of a thread. There should never be more than
|
| +// one object implementing this interface per thread. It provides
|
| +// static current() method that returns the instance of this interface
|
| +// that corresponds to the current thread.
|
| +class BASE_EXPORT ThreadMainTaskRunner : public SingleThreadTaskRunner {
|
| + public:
|
| + // Gets the ThreadMainTaskRunner for the current thread.
|
| + static scoped_refptr<ThreadMainTaskRunner> current();
|
| +
|
| + ThreadMainTaskRunner();
|
| +
|
| + protected:
|
| + virtual ~ThreadMainTaskRunner();
|
| +
|
| + // This method must be called on the thread this object belongs to
|
| + // before the thread and this object are destroyed.
|
| + void Detach();
|
| +
|
| + private:
|
| + bool detached_;
|
| +};
|
| +
|
| +} // namespace base
|
| +
|
| +#endif // BASE_THREAD_MAIN_TASK_RUNNER_H_
|
|
|