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..f57be6d6b1a789c51560c577310603a61019d219 |
--- /dev/null |
+++ b/base/thread_main_task_runner.h |
@@ -0,0 +1,35 @@ |
+// 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 |
+// 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 |
+// insterface that corresponds to the current thread. |
Ami GONE FROM CHROMIUM
2012/04/30 23:34:05
typo: "insterface"
Sergey Ulanov
2012/05/01 00:34:54
Done.
|
+class BASE_EXPORT ThreadMainTaskRunner : public SingleThreadTaskRunner { |
+public: |
+ // Gets the ThreadMainTaskRunner for the current thread. |
+ static scoped_refptr<ThreadMainTaskRunner> current(); |
+ |
+ // Sets ThreadMainTaskRunner for the current thread. The caller |
+ // must keep a reference to the task runner and call this method |
+ // again with new_current=NULL before dropping that reference. |
+ static void SetCurrent(ThreadMainTaskRunner* new_current); |
+ |
+ protected: |
+ virtual ~ThreadMainTaskRunner() {} |
+}; |
+ |
+} // namespace base |
+ |
+#endif // BASE_THREAD_MAIN_TASK_RUNNER_H_ |