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

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

Issue 1095653002: win: Fix a few clang style plugin warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 public: 49 public:
50 class BASE_EXPORT Delegate { 50 class BASE_EXPORT Delegate {
51 public: 51 public:
52 virtual ~Delegate() {} 52 virtual ~Delegate() {}
53 // Called from the MessageLoop when a signaled object is detected. To 53 // Called from the MessageLoop when a signaled object is detected. To
54 // continue watching the object, StartWatching must be called again. 54 // continue watching the object, StartWatching must be called again.
55 virtual void OnObjectSignaled(HANDLE object) = 0; 55 virtual void OnObjectSignaled(HANDLE object) = 0;
56 }; 56 };
57 57
58 ObjectWatcher(); 58 ObjectWatcher();
59 ~ObjectWatcher(); 59 ~ObjectWatcher() override;
60 60
61 // When the object is signaled, the given delegate is notified on the thread 61 // When the object is signaled, the given delegate is notified on the thread
62 // where StartWatching is called. The ObjectWatcher is not responsible for 62 // where StartWatching is called. The ObjectWatcher is not responsible for
63 // deleting the delegate. 63 // deleting the delegate.
64 // 64 //
65 // Returns true if the watch was started. Otherwise, false is returned. 65 // Returns true if the watch was started. Otherwise, false is returned.
66 // 66 //
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
(...skipping 10 matching lines...) Expand all
80 // Returns the handle of the object being watched. 80 // Returns the handle of the object being watched.
81 HANDLE GetWatchedObject() const; 81 HANDLE GetWatchedObject() const;
82 82
83 private: 83 private:
84 // Called on a background thread when done waiting. 84 // Called on a background thread when done waiting.
85 static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out); 85 static void CALLBACK DoneWaiting(void* param, BOOLEAN timed_out);
86 86
87 void Signal(Delegate* delegate); 87 void Signal(Delegate* delegate);
88 88
89 // MessageLoop::DestructionObserver implementation: 89 // MessageLoop::DestructionObserver implementation:
90 virtual void WillDestroyCurrentMessageLoop(); 90 void WillDestroyCurrentMessageLoop() override;
91 91
92 // Internal state. 92 // Internal state.
93 Closure callback_; 93 Closure callback_;
94 HANDLE object_; // The object being watched 94 HANDLE object_; // The object being watched
95 HANDLE wait_object_; // Returned by RegisterWaitForSingleObject 95 HANDLE wait_object_; // Returned by RegisterWaitForSingleObject
96 MessageLoop* origin_loop_; // Used to get back to the origin thread 96 MessageLoop* origin_loop_; // Used to get back to the origin thread
97 97
98 WeakPtrFactory<ObjectWatcher> weak_factory_; 98 WeakPtrFactory<ObjectWatcher> weak_factory_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); 100 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher);
101 }; 101 };
102 102
103 } // namespace win 103 } // namespace win
104 } // namespace base 104 } // namespace base
105 105
106 #endif // BASE_WIN_OBJECT_WATCHER_H_ 106 #endif // BASE_WIN_OBJECT_WATCHER_H_
OLDNEW
« base/message_loop/message_pump_win.h ('K') | « base/message_loop/message_pump_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698