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

Side by Side Diff: base/synchronization/waitable_event_watcher_posix.cc

Issue 16160015: Update base/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « base/prefs/testing_pref_service.h ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/synchronization/waitable_event_watcher.h" 5 #include "base/synchronization/waitable_event_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // No hairpinning - we can't call the delegate directly here. We have to 161 // No hairpinning - we can't call the delegate directly here. We have to
162 // enqueue a task on the MessageLoop as normal. 162 // enqueue a task on the MessageLoop as normal.
163 current_ml->PostTask(FROM_HERE, internal_callback_); 163 current_ml->PostTask(FROM_HERE, internal_callback_);
164 return true; 164 return true;
165 } 165 }
166 166
167 message_loop_ = current_ml; 167 message_loop_ = current_ml;
168 current_ml->AddDestructionObserver(this); 168 current_ml->AddDestructionObserver(this);
169 169
170 kernel_ = kernel; 170 kernel_ = kernel;
171 waiter_ = new AsyncWaiter(current_ml, internal_callback_, cancel_flag_); 171 waiter_ = new AsyncWaiter(current_ml, internal_callback_, cancel_flag_.get());
172 event->Enqueue(waiter_); 172 event->Enqueue(waiter_);
173 173
174 return true; 174 return true;
175 } 175 }
176 176
177 void WaitableEventWatcher::StopWatching() { 177 void WaitableEventWatcher::StopWatching() {
178 callback_.Reset(); 178 callback_.Reset();
179 179
180 if (message_loop_) { 180 if (message_loop_) {
181 message_loop_->RemoveDestructionObserver(this); 181 message_loop_->RemoveDestructionObserver(this);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // ----------------------------------------------------------------------------- 262 // -----------------------------------------------------------------------------
263 // This is called when the MessageLoop which the callback will be run it is 263 // This is called when the MessageLoop which the callback will be run it is
264 // deleted. We need to cancel the callback as if we had been deleted, but we 264 // deleted. We need to cancel the callback as if we had been deleted, but we
265 // will still be deleted at some point in the future. 265 // will still be deleted at some point in the future.
266 // ----------------------------------------------------------------------------- 266 // -----------------------------------------------------------------------------
267 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { 267 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() {
268 StopWatching(); 268 StopWatching();
269 } 269 }
270 270
271 } // namespace base 271 } // namespace base
OLDNEW
« no previous file with comments | « base/prefs/testing_pref_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698