Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: base/win/object_watcher.h

Issue 868143004: Add an explicit ObjectWatcher::IsWatching() method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/win/object_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_WIN_OBJECT_WATCHER_H_ 5 #ifndef BASE_WIN_OBJECT_WATCHER_H_
6 #define BASE_WIN_OBJECT_WATCHER_H_ 6 #define BASE_WIN_OBJECT_WATCHER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 bool StartWatching(HANDLE object, Delegate* delegate); 67 bool StartWatching(HANDLE object, Delegate* delegate);
68 68
69 // Stops watching. Does nothing if the watch has already completed. If the 69 // Stops watching. Does nothing if the watch has already completed. If the
70 // watch is still active, then it is canceled, and the associated delegate is 70 // watch is still active, then it is canceled, and the associated delegate is
71 // not notified. 71 // not notified.
72 // 72 //
73 // Returns true if the watch was canceled. Otherwise, false is returned. 73 // Returns true if the watch was canceled. Otherwise, false is returned.
74 // 74 //
75 bool StopWatching(); 75 bool StopWatching();
76 76
77 // Returns the handle of the object being watched, or NULL if the object 77 // Returns true if currently watching an object.
78 // watcher is stopped. 78 bool IsWatching() const;
79 HANDLE GetWatchedObject(); 79
80 // Returns the handle of the object being watched.
81 HANDLE GetWatchedObject() const;
80 82
81 private: 83 private:
82 // Called on a background thread when done waiting. 84 // Called on a background thread when done waiting.
83 static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out); 85 static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out);
84 86
85 void Signal(Delegate* delegate); 87 void Signal(Delegate* delegate);
86 88
87 // MessageLoop::DestructionObserver implementation: 89 // MessageLoop::DestructionObserver implementation:
88 virtual void WillDestroyCurrentMessageLoop(); 90 virtual void WillDestroyCurrentMessageLoop();
89 91
90 // Internal state. 92 // Internal state.
91 Closure callback_; 93 Closure callback_;
92 HANDLE object_; // The object being watched 94 HANDLE object_; // The object being watched
93 HANDLE wait_object_; // Returned by RegisterWaitForSingleObject 95 HANDLE wait_object_; // Returned by RegisterWaitForSingleObject
94 MessageLoop* origin_loop_; // Used to get back to the origin thread 96 MessageLoop* origin_loop_; // Used to get back to the origin thread
95 97
96 WeakPtrFactory<ObjectWatcher> weak_factory_; 98 WeakPtrFactory<ObjectWatcher> weak_factory_;
97 99
98 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); 100 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher);
99 }; 101 };
100 102
101 } // namespace win 103 } // namespace win
102 } // namespace base 104 } // namespace base
103 105
104 #endif // BASE_OBJECT_WATCHER_H_ 106 #endif // BASE_OBJECT_WATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | base/win/object_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698