OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_THREAD_MAIN_TASK_RUNNER_H_ |
| 6 #define BASE_THREAD_MAIN_TASK_RUNNER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/base_export.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 11 |
| 12 namespace base { |
| 13 |
| 14 // ThreadMainTaskRunner is a SingleThreadTaskRunner that is used for |
| 15 // the main task runner of a thread. There should never be more than |
| 16 // one object implementing this interface per thread. It provides |
| 17 // static current() method that returns the instance of this interface |
| 18 // that corresponds to the current thread. |
| 19 class BASE_EXPORT ThreadMainTaskRunner : public SingleThreadTaskRunner { |
| 20 public: |
| 21 // Gets the ThreadMainTaskRunner for the current thread. |
| 22 static scoped_refptr<ThreadMainTaskRunner> current(); |
| 23 |
| 24 ThreadMainTaskRunner(); |
| 25 |
| 26 protected: |
| 27 virtual ~ThreadMainTaskRunner(); |
| 28 |
| 29 // This method must be called on the thread this object belongs to |
| 30 // before the thread and this object are destroyed. |
| 31 void Detach(); |
| 32 |
| 33 private: |
| 34 bool detached_; |
| 35 }; |
| 36 |
| 37 } // namespace base |
| 38 |
| 39 #endif // BASE_THREAD_MAIN_TASK_RUNNER_H_ |
OLD | NEW |