Chromium Code Reviews| Index: base/win/object_watcher.h |
| diff --git a/base/win/object_watcher.h b/base/win/object_watcher.h |
| index d68d9350b3860f83ae726fc83d3cbbd75618aedc..2cf3ad7f30b7e155522b3fc403701caf3e8a2844 100644 |
| --- a/base/win/object_watcher.h |
| +++ b/base/win/object_watcher.h |
| @@ -26,16 +26,16 @@ namespace win { |
| // |
| // Typical usage: |
| // |
| -// class MyClass : public base::ObjectWatcher::Delegate { |
| +// class MyClass : public base::win::ObjectWatcher::Delegate { |
| // public: |
| // void DoStuffWhenSignaled(HANDLE object) { |
| // watcher_.StartWatching(object, this); |
| // } |
| -// virtual void OnObjectSignaled(HANDLE object) { |
| +// void OnObjectSignaled(HANDLE object) override { |
| // // OK, time to do stuff! |
| // } |
| // private: |
| -// base::ObjectWatcher watcher_; |
| +// base::win::ObjectWatcher watcher_; |
| // }; |
| // |
| // In the above example, MyClass wants to "do stuff" when object becomes |
| @@ -61,10 +61,12 @@ class BASE_EXPORT ObjectWatcher : public MessageLoop::DestructionObserver { |
| // When the object is signaled, the given delegate is notified on the thread |
| // where StartWatching is called. The ObjectWatcher is not responsible for |
| // deleting the delegate. |
| + // If |wait_many| is true, then this calls the callback each time it's |
|
yzshen1
2015/09/23 22:47:08
I feel that "execute_only_once" may be more clear,
|
| + // signalled. |
| // |
| // Returns true if the watch was started. Otherwise, false is returned. |
| // |
| - bool StartWatching(HANDLE object, Delegate* delegate); |
| + bool StartWatching(HANDLE object, Delegate* delegate, bool wait_many); |
| // Stops watching. Does nothing if the watch has already completed. If the |
| // watch is still active, then it is canceled, and the associated delegate is |
| @@ -94,7 +96,7 @@ class BASE_EXPORT ObjectWatcher : public MessageLoop::DestructionObserver { |
| HANDLE object_; // The object being watched |
| HANDLE wait_object_; // Returned by RegisterWaitForSingleObject |
| MessageLoop* origin_loop_; // Used to get back to the origin thread |
| - |
| + bool wait_many_; |
| WeakPtrFactory<ObjectWatcher> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); |