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

Side by Side Diff: base/win/object_watcher.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing includes. Created 5 years, 7 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
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/win/object_watcher.h" 5 #include "base/win/object_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return object_; 85 return object_;
86 } 86 }
87 87
88 // static 88 // static
89 void CALLBACK ObjectWatcher::DoneWaiting(void* param, BOOLEAN timed_out) { 89 void CALLBACK ObjectWatcher::DoneWaiting(void* param, BOOLEAN timed_out) {
90 DCHECK(!timed_out); 90 DCHECK(!timed_out);
91 91
92 // The destructor blocks on any callbacks that are in flight, so we know that 92 // The destructor blocks on any callbacks that are in flight, so we know that
93 // that is always a pointer to a valid ObjectWater. 93 // that is always a pointer to a valid ObjectWater.
94 ObjectWatcher* that = static_cast<ObjectWatcher*>(param); 94 ObjectWatcher* that = static_cast<ObjectWatcher*>(param);
95 that->origin_loop_->PostTask(FROM_HERE, that->callback_); 95 that->origin_loop_->task_runner()->PostTask(FROM_HERE, that->callback_);
96 that->callback_.Reset(); 96 that->callback_.Reset();
97 } 97 }
98 98
99 void ObjectWatcher::Signal(Delegate* delegate) { 99 void ObjectWatcher::Signal(Delegate* delegate) {
100 // Signaling the delegate may result in our destruction or a nested call to 100 // Signaling the delegate may result in our destruction or a nested call to
101 // StartWatching(). As a result, we save any state we need and clear previous 101 // StartWatching(). As a result, we save any state we need and clear previous
102 // watcher state before signaling the delegate. 102 // watcher state before signaling the delegate.
103 HANDLE object = object_; 103 HANDLE object = object_;
104 StopWatching(); 104 StopWatching();
105 delegate->OnObjectSignaled(object); 105 delegate->OnObjectSignaled(object);
106 } 106 }
107 107
108 void ObjectWatcher::WillDestroyCurrentMessageLoop() { 108 void ObjectWatcher::WillDestroyCurrentMessageLoop() {
109 // Need to shutdown the watch so that we don't try to access the MessageLoop 109 // Need to shutdown the watch so that we don't try to access the MessageLoop
110 // after this point. 110 // after this point.
111 StopWatching(); 111 StopWatching();
112 } 112 }
113 113
114 } // namespace win 114 } // namespace win
115 } // namespace base 115 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_unittest.cc ('k') | chrome/browser/prefs/profile_pref_store_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698