diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 03:31:34 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 03:31:34 +0000 |
commit | 2cbac9eb5be45ba99a37b28eb1dbf306ee3e67cd (patch) | |
tree | 9bae18a794cacca3aa2164deca4e6460815f20b9 /chrome/browser/chrome_thread.h | |
parent | ad3d7273dff93e5107a947c05c6a47c35ea7eea7 (diff) | |
download | chromium_src-2cbac9eb5be45ba99a37b28eb1dbf306ee3e67cd.zip chromium_src-2cbac9eb5be45ba99a37b28eb1dbf306ee3e67cd.tar.gz chromium_src-2cbac9eb5be45ba99a37b28eb1dbf306ee3e67cd.tar.bz2 |
Created a MessageLoopProxy interface. This provides a thread-safe refcounted interface to the Post* methods
of a message loop. This class can outlive the target message loop. Changed ChromeThread to vend an implementation of this proxy.
BUG=None
TEST=ChromeThread unit-tests modified.
Review URL: http://codereview.chromium.org/1800008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_thread.h')
-rw-r--r-- | chrome/browser/chrome_thread.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/chrome_thread.h b/chrome/browser/chrome_thread.h index 9628e2f..676f6b7 100644 --- a/chrome/browser/chrome_thread.h +++ b/chrome/browser/chrome_thread.h @@ -9,6 +9,8 @@ #include "base/task.h" #include "base/thread.h" +class MessageLoopProxy; + /////////////////////////////////////////////////////////////////////////////// // ChromeThread // @@ -126,6 +128,11 @@ class ChromeThread : public base::Thread { // sets identifier to its ID. Otherwise returns false. static bool GetCurrentThreadIdentifier(ID* identifier); + // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime + // of the thread. + static scoped_refptr<MessageLoopProxy> GetMessageLoopProxyForThread( + ID identifier); + // Use these templates in conjuction with RefCountedThreadSafe when you want // to ensure that an object is deleted on a specific thread. This is needed // when an object can hop between threads (i.e. IO -> FILE -> IO), and thread |