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

Unified Diff: base/message_loop_proxy_impl.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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.h ('k') | base/message_loop_proxy_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop_proxy_impl.cc
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc
index af0d21439b82618fc303f3fc326e995c64d73dec..6b52351c29967b43be3b57fa1b4cb1d8324e1068 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
« no previous file with comments | « base/message_loop_proxy_impl.h ('k') | base/message_loop_proxy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698