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

Side by Side Diff: base/waitable_event_watcher.h

Issue 271033: Multiple sync channels if used in the same listener thread could result in ca... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/waitable_event_watcher_posix.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) 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_WAITABLE_EVENT_WATCHER_H_ 5 #ifndef BASE_WAITABLE_EVENT_WATCHER_H_
6 #define BASE_WAITABLE_EVENT_WATCHER_H_ 6 #define BASE_WAITABLE_EVENT_WATCHER_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // function, it cannot be called during this function either. 99 // function, it cannot be called during this function either.
100 // --------------------------------------------------------------------------- 100 // ---------------------------------------------------------------------------
101 void StopWatching(); 101 void StopWatching();
102 102
103 // --------------------------------------------------------------------------- 103 // ---------------------------------------------------------------------------
104 // Return the currently watched event, or NULL if no object is currently being 104 // Return the currently watched event, or NULL if no object is currently being
105 // watched. 105 // watched.
106 // --------------------------------------------------------------------------- 106 // ---------------------------------------------------------------------------
107 WaitableEvent* GetWatchedEvent(); 107 WaitableEvent* GetWatchedEvent();
108 108
109 // ---------------------------------------------------------------------------
110 // Return the delegate, or NULL if there is no delegate.
111 // ---------------------------------------------------------------------------
112 Delegate* delegate() {
113 return delegate_;
114 }
115
109 private: 116 private:
110 WaitableEvent* event_; 117 WaitableEvent* event_;
111 118
112 #if defined(OS_WIN) 119 #if defined(OS_WIN)
113 // --------------------------------------------------------------------------- 120 // ---------------------------------------------------------------------------
114 // The helper class exists because, if WaitableEventWatcher were to inherit 121 // The helper class exists because, if WaitableEventWatcher were to inherit
115 // from ObjectWatcher::Delegate, then it couldn't also have an inner class 122 // from ObjectWatcher::Delegate, then it couldn't also have an inner class
116 // called Delegate (at least on Windows). Thus this object exists to proxy 123 // called Delegate (at least on Windows). Thus this object exists to proxy
117 // the callback function 124 // the callback function
118 // --------------------------------------------------------------------------- 125 // ---------------------------------------------------------------------------
119 class ObjectWatcherHelper : public ObjectWatcher::Delegate { 126 class ObjectWatcherHelper : public ObjectWatcher::Delegate {
120 public: 127 public:
121 ObjectWatcherHelper(WaitableEventWatcher* watcher); 128 ObjectWatcherHelper(WaitableEventWatcher* watcher);
122 129
123 // ------------------------------------------------------------------------- 130 // -------------------------------------------------------------------------
124 // Implementation of ObjectWatcher::Delegate 131 // Implementation of ObjectWatcher::Delegate
125 // ------------------------------------------------------------------------- 132 // -------------------------------------------------------------------------
126 void OnObjectSignaled(HANDLE h); 133 void OnObjectSignaled(HANDLE h);
127 134
128 private: 135 private:
129 WaitableEventWatcher *const watcher_; 136 WaitableEventWatcher *const watcher_;
130 }; 137 };
131 138
132 void OnObjectSignaled(); 139 void OnObjectSignaled();
133 140
134 Delegate* delegate_;
135 ObjectWatcherHelper helper_; 141 ObjectWatcherHelper helper_;
136 ObjectWatcher watcher_; 142 ObjectWatcher watcher_;
137 #else 143 #else
138 // --------------------------------------------------------------------------- 144 // ---------------------------------------------------------------------------
139 // Implementation of MessageLoop::DestructionObserver 145 // Implementation of MessageLoop::DestructionObserver
140 // --------------------------------------------------------------------------- 146 // ---------------------------------------------------------------------------
141 void WillDestroyCurrentMessageLoop(); 147 void WillDestroyCurrentMessageLoop();
142 148
143 MessageLoop* message_loop_; 149 MessageLoop* message_loop_;
144 scoped_refptr<Flag> cancel_flag_; 150 scoped_refptr<Flag> cancel_flag_;
145 AsyncWaiter* waiter_; 151 AsyncWaiter* waiter_;
146 AsyncCallbackTask* callback_task_; 152 AsyncCallbackTask* callback_task_;
147 scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_; 153 scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_;
148 #endif 154 #endif
155
156 Delegate* delegate_;
149 }; 157 };
150 158
151 } // namespace base 159 } // namespace base
152 160
153 #endif // BASE_WAITABLE_EVENT_WATCHER_H_ 161 #endif // BASE_WAITABLE_EVENT_WATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | base/waitable_event_watcher_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698