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

Unified Diff: base/message_loop.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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
« no previous file with comments | « base/message_loop.h ('k') | base/message_loop_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop.cc
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 10f4a262f55f422393f7ad88f6e56986ec6e1221..02534f51a3a43779b4bfff93ccc233ca1384869f 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -12,6 +12,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop_proxy_impl.h"
#include "base/message_pump_default.h"
#include "base/metrics/histogram.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
@@ -135,6 +136,8 @@ MessageLoop::MessageLoop(Type type)
DCHECK(!current()) << "should only have one message loop per thread";
lazy_tls_ptr.Pointer()->Set(this);
+ message_loop_proxy_ = new base::MessageLoopProxyImpl();
+
// TODO(rvargas): Get rid of the OS guards.
#if defined(OS_WIN)
#define MESSAGE_PUMP_UI new base::MessagePumpForUI()
@@ -202,6 +205,11 @@ MessageLoop::~MessageLoop() {
FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_,
WillDestroyCurrentMessageLoop());
+ // Tell the message_loop_proxy that we are dying.
+ static_cast<base::MessageLoopProxyImpl*>(message_loop_proxy_.get())->
+ WillDestroyCurrentMessageLoop();
+ message_loop_proxy_ = NULL;
+
// OK, now make it so that no one can find us.
lazy_tls_ptr.Pointer()->Set(NULL);
« no previous file with comments | « base/message_loop.h ('k') | base/message_loop_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698