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

Side by Side Diff: base/waitable_event_watcher.h

Issue 5971008: move base/object_watcher into base/win and add the win namespace. Fixup calle... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « base/object_watcher_unittest.cc ('k') | base/waitable_event_watcher_win.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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
11 #if defined(OS_WIN) 11 #if defined(OS_WIN)
12 #include "base/object_watcher.h" 12 #include "base/win/object_watcher.h"
13 #else 13 #else
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/waitable_event.h" 15 #include "base/waitable_event.h"
16 #endif 16 #endif
17 17
18 namespace base { 18 namespace base {
19 19
20 class Flag; 20 class Flag;
21 class AsyncWaiter; 21 class AsyncWaiter;
22 class AsyncCallbackTask; 22 class AsyncCallbackTask;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 private: 117 private:
118 WaitableEvent* event_; 118 WaitableEvent* event_;
119 119
120 #if defined(OS_WIN) 120 #if defined(OS_WIN)
121 // --------------------------------------------------------------------------- 121 // ---------------------------------------------------------------------------
122 // The helper class exists because, if WaitableEventWatcher were to inherit 122 // The helper class exists because, if WaitableEventWatcher were to inherit
123 // from ObjectWatcher::Delegate, then it couldn't also have an inner class 123 // from ObjectWatcher::Delegate, then it couldn't also have an inner class
124 // called Delegate (at least on Windows). Thus this object exists to proxy 124 // called Delegate (at least on Windows). Thus this object exists to proxy
125 // the callback function 125 // the callback function
126 // --------------------------------------------------------------------------- 126 // ---------------------------------------------------------------------------
127 class ObjectWatcherHelper : public ObjectWatcher::Delegate { 127 class ObjectWatcherHelper : public win::ObjectWatcher::Delegate {
128 public: 128 public:
129 ObjectWatcherHelper(WaitableEventWatcher* watcher); 129 ObjectWatcherHelper(WaitableEventWatcher* watcher);
130 130
131 // ------------------------------------------------------------------------- 131 // -------------------------------------------------------------------------
132 // Implementation of ObjectWatcher::Delegate 132 // Implementation of ObjectWatcher::Delegate
133 // ------------------------------------------------------------------------- 133 // -------------------------------------------------------------------------
134 void OnObjectSignaled(HANDLE h); 134 void OnObjectSignaled(HANDLE h);
135 135
136 private: 136 private:
137 WaitableEventWatcher *const watcher_; 137 WaitableEventWatcher *const watcher_;
138 }; 138 };
139 139
140 void OnObjectSignaled(); 140 void OnObjectSignaled();
141 141
142 ObjectWatcherHelper helper_; 142 ObjectWatcherHelper helper_;
143 ObjectWatcher watcher_; 143 win::ObjectWatcher watcher_;
144 #else 144 #else
145 // --------------------------------------------------------------------------- 145 // ---------------------------------------------------------------------------
146 // Implementation of MessageLoop::DestructionObserver 146 // Implementation of MessageLoop::DestructionObserver
147 // --------------------------------------------------------------------------- 147 // ---------------------------------------------------------------------------
148 virtual void WillDestroyCurrentMessageLoop(); 148 virtual void WillDestroyCurrentMessageLoop();
149 149
150 MessageLoop* message_loop_; 150 MessageLoop* message_loop_;
151 scoped_refptr<Flag> cancel_flag_; 151 scoped_refptr<Flag> cancel_flag_;
152 AsyncWaiter* waiter_; 152 AsyncWaiter* waiter_;
153 AsyncCallbackTask* callback_task_; 153 AsyncCallbackTask* callback_task_;
154 scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_; 154 scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_;
155 #endif 155 #endif
156 156
157 Delegate* delegate_; 157 Delegate* delegate_;
158 }; 158 };
159 159
160 } // namespace base 160 } // namespace base
161 161
162 #endif // BASE_WAITABLE_EVENT_WATCHER_H_ 162 #endif // BASE_WAITABLE_EVENT_WATCHER_H_
OLDNEW
« no previous file with comments | « base/object_watcher_unittest.cc ('k') | base/waitable_event_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698