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

Unified Diff: base/message_loop.cc

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/message_loop.cc
diff --git a/base/message_loop.cc b/base/message_loop.cc
index f60bf69d8302a2c8122cbf26ef5948f340656178..28bcc614cbfa4808131578ce9f6ad70c3f82666f 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -139,6 +139,7 @@ MessageLoop::MessageLoop(Type type)
lazy_tls_ptr.Pointer()->Set(this);
message_loop_proxy_ = new base::MessageLoopProxyImpl();
+ base::ThreadMainTaskRunner::SetCurrent(message_loop_proxy_);
// TODO(rvargas): Get rid of the OS guards.
#if defined(OS_WIN)
@@ -199,6 +200,7 @@ MessageLoop::~MessageLoop() {
WillDestroyCurrentMessageLoop());
// Tell the message_loop_proxy that we are dying.
+ base::ThreadMainTaskRunner::SetCurrent(NULL);
static_cast<base::MessageLoopProxyImpl*>(message_loop_proxy_.get())->
WillDestroyCurrentMessageLoop();
message_loop_proxy_ = NULL;
« no previous file with comments | « base/base.gypi ('k') | base/message_loop_proxy.h » ('j') | base/thread_main_task_runner.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698