OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_OBJECT_WATCHER_H_ | 5 #ifndef BASE_OBJECT_WATCHER_H_ |
6 #define BASE_OBJECT_WATCHER_H_ | 6 #define BASE_OBJECT_WATCHER_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 bool StartWatching(HANDLE object, Delegate* delegate); | 61 bool StartWatching(HANDLE object, Delegate* delegate); |
62 | 62 |
63 // Stops watching. Does nothing if the watch has already completed. If the | 63 // Stops watching. Does nothing if the watch has already completed. If the |
64 // watch is still active, then it is canceled, and the associated delegate is | 64 // watch is still active, then it is canceled, and the associated delegate is |
65 // not notified. | 65 // not notified. |
66 // | 66 // |
67 // Returns true if the watch was canceled. Otherwise, false is returned. | 67 // Returns true if the watch was canceled. Otherwise, false is returned. |
68 // | 68 // |
69 bool StopWatching(); | 69 bool StopWatching(); |
70 | 70 |
| 71 // Returns the handle of the object being watched, or NULL if the object |
| 72 // watcher is stopped. |
| 73 HANDLE GetWatchedObject(); |
| 74 |
71 private: | 75 private: |
72 // Called on a background thread when done waiting. | 76 // Called on a background thread when done waiting. |
73 static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out); | 77 static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out); |
74 | 78 |
75 // MessageLoop::DestructionObserver implementation: | 79 // MessageLoop::DestructionObserver implementation: |
76 virtual void WillDestroyCurrentMessageLoop(); | 80 virtual void WillDestroyCurrentMessageLoop(); |
77 | 81 |
78 // Internal state. | 82 // Internal state. |
79 struct Watch; | 83 struct Watch; |
80 Watch* watch_; | 84 Watch* watch_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); | 86 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); |
83 }; | 87 }; |
84 } // namespace base | 88 } // namespace base |
85 | 89 |
86 #endif // BASE_OBJECT_WATCHER_H_ | 90 #endif // BASE_OBJECT_WATCHER_H_ |
87 | 91 |
OLD | NEW |