diff options
author | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:33:46 +0000 |
---|---|---|
committer | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:33:46 +0000 |
commit | edd685f15dfd2841aaeddab567aea0623db1ae69 (patch) | |
tree | 9caa53e84eb2787471dd16009daf02fb85f8890e /base/message_loop_proxy_impl.cc | |
parent | 5b79e5250785613d6dc7a42a27a45bb44b9cf7a0 (diff) | |
download | chromium_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_impl.cc')
-rw-r--r-- | base/message_loop_proxy_impl.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc index af0d214..6b52351 100644 --- a/base/message_loop_proxy_impl.cc +++ b/base/message_loop_proxy_impl.cc @@ -8,13 +8,6 @@ namespace base { MessageLoopProxyImpl::~MessageLoopProxyImpl() { - AutoLock lock(message_loop_lock_); - // If the target message loop still exists, the d'tor WILL execute on the - // target loop. - if (target_message_loop_) { - DCHECK(MessageLoop::current() == target_message_loop_); - MessageLoop::current()->RemoveDestructionObserver(this); - } } // MessageLoopProxy implementation @@ -102,7 +95,6 @@ void MessageLoopProxyImpl::OnDestruct() const { MessageLoopProxyImpl::MessageLoopProxyImpl() : target_message_loop_(MessageLoop::current()) { - target_message_loop_->AddDestructionObserver(this); } bool MessageLoopProxyImpl::PostTaskHelper( @@ -143,9 +135,11 @@ bool MessageLoopProxyImpl::PostTaskHelper( } scoped_refptr<MessageLoopProxy> -MessageLoopProxy::CreateForCurrentThread() { - scoped_refptr<MessageLoopProxy> ret(new MessageLoopProxyImpl()); - return ret; +MessageLoopProxy::current() { + MessageLoop* cur_loop = MessageLoop::current(); + if (!cur_loop) + return NULL; + return cur_loop->message_loop_proxy(); } } // namespace base |