| 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 #ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ | 5 #ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ |
| 6 #define BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ | 6 #define BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 WaitableEvent* GetWatchedEvent(); | 108 WaitableEvent* GetWatchedEvent(); |
| 109 | 109 |
| 110 // --------------------------------------------------------------------------- | 110 // --------------------------------------------------------------------------- |
| 111 // Return the delegate, or NULL if there is no delegate. | 111 // Return the delegate, or NULL if there is no delegate. |
| 112 // --------------------------------------------------------------------------- | 112 // --------------------------------------------------------------------------- |
| 113 Delegate* delegate() { | 113 Delegate* delegate() { |
| 114 return delegate_; | 114 return delegate_; |
| 115 } | 115 } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 WaitableEvent* event_; | |
| 119 | |
| 120 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
| 121 // --------------------------------------------------------------------------- | 119 // --------------------------------------------------------------------------- |
| 122 // The helper class exists because, if WaitableEventWatcher were to inherit | 120 // The helper class exists because, if WaitableEventWatcher were to inherit |
| 123 // from ObjectWatcher::Delegate, then it couldn't also have an inner class | 121 // from ObjectWatcher::Delegate, then it couldn't also have an inner class |
| 124 // called Delegate (at least on Windows). Thus this object exists to proxy | 122 // called Delegate (at least on Windows). Thus this object exists to proxy |
| 125 // the callback function | 123 // the callback function |
| 126 // --------------------------------------------------------------------------- | 124 // --------------------------------------------------------------------------- |
| 127 class ObjectWatcherHelper : public win::ObjectWatcher::Delegate { | 125 class ObjectWatcherHelper : public win::ObjectWatcher::Delegate { |
| 128 public: | 126 public: |
| 129 ObjectWatcherHelper(WaitableEventWatcher* watcher); | 127 ObjectWatcherHelper(WaitableEventWatcher* watcher); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 147 // --------------------------------------------------------------------------- | 145 // --------------------------------------------------------------------------- |
| 148 virtual void WillDestroyCurrentMessageLoop(); | 146 virtual void WillDestroyCurrentMessageLoop(); |
| 149 | 147 |
| 150 MessageLoop* message_loop_; | 148 MessageLoop* message_loop_; |
| 151 scoped_refptr<Flag> cancel_flag_; | 149 scoped_refptr<Flag> cancel_flag_; |
| 152 AsyncWaiter* waiter_; | 150 AsyncWaiter* waiter_; |
| 153 AsyncCallbackTask* callback_task_; | 151 AsyncCallbackTask* callback_task_; |
| 154 scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_; | 152 scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_; |
| 155 #endif | 153 #endif |
| 156 | 154 |
| 155 WaitableEvent* event_; |
| 156 |
| 157 Delegate* delegate_; | 157 Delegate* delegate_; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 } // namespace base | 160 } // namespace base |
| 161 | 161 |
| 162 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ | 162 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ |
| OLD | NEW |