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

Unified Diff: base/message_loop.cc

Issue 10380016: Add base::ThreadTaskRunner class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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_unittest.cc » ('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 f60bf69d8302a2c8122cbf26ef5948f340656178..dd8ba3ad06891fd6d2409d36c94ced6ffa7f6310 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -17,6 +17,7 @@
#include "base/message_pump_default.h"
#include "base/metrics/histogram.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_local.h"
#include "base/time.h"
#include "base/tracked_objects.h"
@@ -139,6 +140,8 @@ MessageLoop::MessageLoop(Type type)
lazy_tls_ptr.Pointer()->Set(this);
message_loop_proxy_ = new base::MessageLoopProxyImpl();
+ thread_task_runner_handle_.reset(
+ new base::ThreadTaskRunnerHandle(message_loop_proxy_));
// TODO(rvargas): Get rid of the OS guards.
#if defined(OS_WIN)
@@ -198,6 +201,8 @@ MessageLoop::~MessageLoop() {
FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_,
WillDestroyCurrentMessageLoop());
+ thread_task_runner_handle_.reset();
Ryan Sleevi 2012/05/31 19:36:41 Not to resurrect a dead review, but when looking a
Sergey Ulanov 2012/05/31 20:14:04 This code runs only after all message loop destruc
+
// Tell the message_loop_proxy that we are dying.
static_cast<base::MessageLoopProxyImpl*>(message_loop_proxy_.get())->
WillDestroyCurrentMessageLoop();
« no previous file with comments | « base/message_loop.h ('k') | base/message_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698