Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: base/thread_main_task_runner.h

Issue 10210008: Make MessageLoopProxy::current() usable on threads that don't have MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698