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

Side by Side Diff: base/message_loop_proxy_impl.cc

Issue 3869003: Const-ify RefCountedThreadSafe::AddRef and Release. (Closed)
Patch Set: actually remove the cast Created 10 years, 2 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/message_loop_proxy_impl.h" 5 #include "base/message_loop_proxy_impl.h"
6 6
7 namespace base { 7 namespace base {
8 8
9 MessageLoopProxyImpl::MessageLoopProxyImpl() 9 MessageLoopProxyImpl::MessageLoopProxyImpl()
10 : target_message_loop_(MessageLoop::current()) { 10 : target_message_loop_(MessageLoop::current()) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 delay_ms); 64 delay_ms);
65 } 65 }
66 ret = true; 66 ret = true;
67 } 67 }
68 } 68 }
69 if (!ret) 69 if (!ret)
70 delete task; 70 delete task;
71 return ret; 71 return ret;
72 } 72 }
73 73
74 void MessageLoopProxyImpl::OnDestruct() { 74 void MessageLoopProxyImpl::OnDestruct() const {
75 bool delete_later = false; 75 bool delete_later = false;
76 { 76 {
77 AutoLock lock(message_loop_lock_); 77 AutoLock lock(message_loop_lock_);
78 if (target_message_loop_ && 78 if (target_message_loop_ &&
79 (MessageLoop::current() != target_message_loop_)) { 79 (MessageLoop::current() != target_message_loop_)) {
80 target_message_loop_->DeleteSoon(FROM_HERE, this); 80 target_message_loop_->DeleteSoon(FROM_HERE, this);
81 delete_later = true; 81 delete_later = true;
82 } 82 }
83 } 83 }
84 if (!delete_later) 84 if (!delete_later)
85 delete this; 85 delete this;
86 } 86 }
87 87
88 // MessageLoop::DestructionObserver implementation 88 // MessageLoop::DestructionObserver implementation
89 void MessageLoopProxyImpl::WillDestroyCurrentMessageLoop() { 89 void MessageLoopProxyImpl::WillDestroyCurrentMessageLoop() {
90 AutoLock lock(message_loop_lock_); 90 AutoLock lock(message_loop_lock_);
91 target_message_loop_ = NULL; 91 target_message_loop_ = NULL;
92 } 92 }
93 93
94 scoped_refptr<MessageLoopProxy> 94 scoped_refptr<MessageLoopProxy>
95 MessageLoopProxy::CreateForCurrentThread() { 95 MessageLoopProxy::CreateForCurrentThread() {
96 scoped_refptr<MessageLoopProxy> ret = new MessageLoopProxyImpl(); 96 scoped_refptr<MessageLoopProxy> ret = new MessageLoopProxyImpl();
97 return ret; 97 return ret;
98 } 98 }
99 99
100 } // namespace base 100 } // namespace base
101 101
OLDNEW
« 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