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

Unified Diff: base/thread.h

Issue 1837003: Created a stock implementation of the MessageLoopProxy interface than can be ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Rearranged header files Created 10 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
« no previous file with comments | « base/message_loop_proxy_impl_unittest.cc ('k') | base/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/thread.h
===================================================================
--- base/thread.h (revision 46408)
+++ base/thread.h (working copy)
@@ -8,6 +8,7 @@
#include <string>
#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
#include "base/platform_thread.h"
namespace base {
@@ -104,6 +105,16 @@
//
MessageLoop* message_loop() const { return message_loop_; }
+ // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's
+ // PostTask methods to execute code on the thread. This only returns
+ // non-null after a successful call to Start. After Stop has been called,
+ // this will return NULL. Callers can hold on to this even after the thread
+ // is gone.
+ // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy.
+ scoped_refptr<MessageLoopProxy> message_loop_proxy() {
+ return message_loop_proxy_;
+ }
+
// Set the name of this thread (for display in debugger too).
const std::string &thread_name() { return name_; }
@@ -162,6 +173,10 @@
// by the created thread.
MessageLoop* message_loop_;
+ // A MessageLoopProxy implementation that targets this thread. This can
+ // outlive the thread.
+ scoped_refptr<MessageLoopProxy> message_loop_proxy_;
+
// Our thread's ID.
PlatformThreadId thread_id_;
« no previous file with comments | « base/message_loop_proxy_impl_unittest.cc ('k') | base/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698