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

Unified Diff: base/single_thread_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: SingleThreadTaskRunner::current() 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/single_thread_task_runner.h
diff --git a/base/single_thread_task_runner.h b/base/single_thread_task_runner.h
index c87e5f7ff1438c4599b18d5c146b2de89c9476ef..46d2ab418310a7f52b57b1bc87dc647a04df3eeb 100644
--- a/base/single_thread_task_runner.h
+++ b/base/single_thread_task_runner.h
@@ -32,6 +32,14 @@ class BASE_EXPORT SingleThreadTaskRunner : public SequencedTaskRunner {
return RunsTasksOnCurrentThread();
}
+ // Gets the SingleThreadTaskRunner for the current thread.
+ static scoped_refptr<SingleThreadTaskRunner> current();
+
+ // Sets SingleThreadTaskRunner 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(SingleThreadTaskRunner* new_current);
+
protected:
virtual ~SingleThreadTaskRunner() {}
};

Powered by Google App Engine
This is Rietveld 408576698