| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdbool.h> |
| 6 #include <stddef.h> |
| 6 | 7 |
| 8 #include "base/logging.h" |
| 7 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/ref_counted.h" |
| 8 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 9 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/synchronization/waitable_event_watcher.h" |
| 14 #include "base/task.h" |
| 15 #include "base/tracked.h" |
| 10 | 16 |
| 11 namespace base { | 17 namespace base { |
| 12 | 18 |
| 13 // ----------------------------------------------------------------------------- | 19 // ----------------------------------------------------------------------------- |
| 14 // WaitableEventWatcher (async waits). | 20 // WaitableEventWatcher (async waits). |
| 15 // | 21 // |
| 16 // The basic design is that we add an AsyncWaiter to the wait-list of the event. | 22 // The basic design is that we add an AsyncWaiter to the wait-list of the event. |
| 17 // That AsyncWaiter has a pointer to MessageLoop, and a Task to be posted to it. | 23 // That AsyncWaiter has a pointer to MessageLoop, and a Task to be posted to it. |
| 18 // The MessageLoop ends up running the task, which calls the delegate. | 24 // The MessageLoop ends up running the task, which calls the delegate. |
| 19 // | 25 // |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // ----------------------------------------------------------------------------- | 277 // ----------------------------------------------------------------------------- |
| 272 // This is called when the MessageLoop which the callback will be run it is | 278 // This is called when the MessageLoop which the callback will be run it is |
| 273 // deleted. We need to cancel the callback as if we had been deleted, but we | 279 // deleted. We need to cancel the callback as if we had been deleted, but we |
| 274 // will still be deleted at some point in the future. | 280 // will still be deleted at some point in the future. |
| 275 // ----------------------------------------------------------------------------- | 281 // ----------------------------------------------------------------------------- |
| 276 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { | 282 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { |
| 277 StopWatching(); | 283 StopWatching(); |
| 278 } | 284 } |
| 279 | 285 |
| 280 } // namespace base | 286 } // namespace base |
| OLD | NEW |