| 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 "base/base_export.h" | 9 #include "base/base_export.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 : public MessageLoop::DestructionObserver | 65 : public MessageLoop::DestructionObserver |
| 66 #endif | 66 #endif |
| 67 { | 67 { |
| 68 public: | 68 public: |
| 69 | 69 |
| 70 WaitableEventWatcher(); | 70 WaitableEventWatcher(); |
| 71 virtual ~WaitableEventWatcher(); | 71 virtual ~WaitableEventWatcher(); |
| 72 | 72 |
| 73 class BASE_EXPORT Delegate { | 73 class BASE_EXPORT Delegate { |
| 74 public: | 74 public: |
| 75 virtual ~Delegate() { } | |
| 76 | |
| 77 // ------------------------------------------------------------------------- | 75 // ------------------------------------------------------------------------- |
| 78 // This is called on the MessageLoop thread when WaitableEvent has been | 76 // This is called on the MessageLoop thread when WaitableEvent has been |
| 79 // signaled. | 77 // signaled. |
| 80 // | 78 // |
| 81 // Note: the event may not be signaled by the time that this function is | 79 // Note: the event may not be signaled by the time that this function is |
| 82 // called. This indicates only that it has been signaled at some point in | 80 // called. This indicates only that it has been signaled at some point in |
| 83 // the past. | 81 // the past. |
| 84 // ------------------------------------------------------------------------- | 82 // ------------------------------------------------------------------------- |
| 85 virtual void OnWaitableEventSignaled(WaitableEvent* waitable_event) = 0; | 83 virtual void OnWaitableEventSignaled(WaitableEvent* waitable_event) = 0; |
| 84 |
| 85 protected: |
| 86 virtual ~Delegate() { } |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 // --------------------------------------------------------------------------- | 89 // --------------------------------------------------------------------------- |
| 89 // When @event is signaled, the given delegate is called on the thread of the | 90 // When @event is signaled, the given delegate is called on the thread of the |
| 90 // current message loop when StartWatching is called. The delegate is not | 91 // current message loop when StartWatching is called. The delegate is not |
| 91 // deleted. | 92 // deleted. |
| 92 // --------------------------------------------------------------------------- | 93 // --------------------------------------------------------------------------- |
| 93 bool StartWatching(WaitableEvent* event, Delegate* delegate); | 94 bool StartWatching(WaitableEvent* event, Delegate* delegate); |
| 94 | 95 |
| 95 // --------------------------------------------------------------------------- | 96 // --------------------------------------------------------------------------- |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 #endif | 156 #endif |
| 156 | 157 |
| 157 WaitableEvent* event_; | 158 WaitableEvent* event_; |
| 158 | 159 |
| 159 Delegate* delegate_; | 160 Delegate* delegate_; |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // namespace base | 163 } // namespace base |
| 163 | 164 |
| 164 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ | 165 #endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ |
| OLD | NEW |