Chromium Code Reviews| 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..d741362c6a4bf65b1de515c466842b8c0fcabcab |
| --- /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 SignleThreadTaskRunner that is used for |
|
willchan no longer on Chromium
2012/05/02 00:17:12
SingleThreadTaskRunner
Sergey Ulanov
2012/05/02 00:30:35
Done.
|
| +// 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_ |