summaryrefslogtreecommitdiffstats
path: root/base/message_loop_proxy.h
diff options
context:
space:
mode:
authornduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-15 20:33:46 +0000
committernduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-15 20:33:46 +0000
commitedd685f15dfd2841aaeddab567aea0623db1ae69 (patch)
tree9caa53e84eb2787471dd16009daf02fb85f8890e /base/message_loop_proxy.h
parent5b79e5250785613d6dc7a42a27a45bb44b9cf7a0 (diff)
downloadchromium_src-edd685f15dfd2841aaeddab567aea0623db1ae69.zip
chromium_src-edd685f15dfd2841aaeddab567aea0623db1ae69.tar.gz
chromium_src-edd685f15dfd2841aaeddab567aea0623db1ae69.tar.bz2
Add MessageLoopProxy::current
Review URL: http://codereview.chromium.org/7583053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop_proxy.h')
-rw-r--r--base/message_loop_proxy.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/base/message_loop_proxy.h b/base/message_loop_proxy.h
index 646b2ef..9a856bf 100644
--- a/base/message_loop_proxy.h
+++ b/base/message_loop_proxy.h
@@ -17,9 +17,12 @@ namespace base {
struct MessageLoopProxyTraits;
// This class provides a thread-safe refcounted interface to the Post* methods
-// of a message loop. This class can outlive the target message loop. You can
-// obtain a MessageLoopProxy via Thread::message_loop_proxy() or
-// MessageLoopProxy::CreateForCurrentThread().
+// of a message loop. This class can outlive the target message loop.
+// MessageLoopProxy objects are constructed automatically for all MessageLoops.
+// So, to access them, you can use any of the following:
+// Thread::message_loop_proxy()
+// MessageLoop::current()->message_loop_proxy()
+// MessageLoopProxy::current()
class BASE_EXPORT MessageLoopProxy
: public base::RefCountedThreadSafe<MessageLoopProxy,
MessageLoopProxyTraits> {
@@ -78,9 +81,9 @@ class BASE_EXPORT MessageLoopProxy
return PostNonNestableTask(from_here, new ReleaseTask<T>(object));
}
- // Factory method for creating an implementation of MessageLoopProxy
- // for the current thread.
- static scoped_refptr<MessageLoopProxy> CreateForCurrentThread();
+ // Gets the MessageLoopProxy for the current message loop, creating one if
+ // needed.
+ static scoped_refptr<MessageLoopProxy> current();
protected:
friend class RefCountedThreadSafe<MessageLoopProxy, MessageLoopProxyTraits>;