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

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: 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/message_loop.cc
diff --git a/base/message_loop.cc b/base/message_loop.cc
index f60bf69d8302a2c8122cbf26ef5948f340656178..a98abced68acb043eb3033afd387588d961cef1e 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::SingleThreadTaskRunner::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::SingleThreadTaskRunner::SetCurrent(NULL);
static_cast<base::MessageLoopProxyImpl*>(message_loop_proxy_.get())->
WillDestroyCurrentMessageLoop();
message_loop_proxy_ = NULL;

Powered by Google App Engine
This is Rietveld 408576698