| 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 "base/synchronization/waitable_event_watcher.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // We are deleted by the MessageLoop | 111 // We are deleted by the MessageLoop |
| 112 } | 112 } |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 scoped_refptr<Flag> flag_; | 115 scoped_refptr<Flag> flag_; |
| 116 WaitableEventWatcher::Delegate *const delegate_; | 116 WaitableEventWatcher::Delegate *const delegate_; |
| 117 WaitableEvent *const event_; | 117 WaitableEvent *const event_; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 WaitableEventWatcher::WaitableEventWatcher() | 120 WaitableEventWatcher::WaitableEventWatcher() |
| 121 : event_(NULL), | 121 : message_loop_(NULL), |
| 122 message_loop_(NULL), | |
| 123 cancel_flag_(NULL), | 122 cancel_flag_(NULL), |
| 124 waiter_(NULL), | 123 waiter_(NULL), |
| 125 callback_task_(NULL), | 124 callback_task_(NULL), |
| 125 event_(NULL), |
| 126 delegate_(NULL) { | 126 delegate_(NULL) { |
| 127 } | 127 } |
| 128 | 128 |
| 129 WaitableEventWatcher::~WaitableEventWatcher() { | 129 WaitableEventWatcher::~WaitableEventWatcher() { |
| 130 StopWatching(); | 130 StopWatching(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // ----------------------------------------------------------------------------- | 133 // ----------------------------------------------------------------------------- |
| 134 // The Handle is how the user cancels a wait. After deleting the Handle we | 134 // The Handle is how the user cancels a wait. After deleting the Handle we |
| 135 // insure that the delegate cannot be called. | 135 // insure that the delegate cannot be called. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // ----------------------------------------------------------------------------- | 271 // ----------------------------------------------------------------------------- |
| 272 // This is called when the MessageLoop which the callback will be run it is | 272 // 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 | 273 // 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. | 274 // will still be deleted at some point in the future. |
| 275 // ----------------------------------------------------------------------------- | 275 // ----------------------------------------------------------------------------- |
| 276 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { | 276 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { |
| 277 StopWatching(); | 277 StopWatching(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace base | 280 } // namespace base |
| OLD | NEW |