OLD | NEW |
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_MESSAGE_PUMP_WIN_H_ | 5 #ifndef BASE_MESSAGE_PUMP_WIN_H_ |
6 #define BASE_MESSAGE_PUMP_WIN_H_ | 6 #define BASE_MESSAGE_PUMP_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Used to count how many Run() invocations are on the stack. | 91 // Used to count how many Run() invocations are on the stack. |
92 int run_depth; | 92 int run_depth; |
93 }; | 93 }; |
94 | 94 |
95 virtual void DoRunLoop() = 0; | 95 virtual void DoRunLoop() = 0; |
96 int GetCurrentDelay() const; | 96 int GetCurrentDelay() const; |
97 | 97 |
98 ObserverList<Observer> observers_; | 98 ObserverList<Observer> observers_; |
99 | 99 |
100 // The time at which delayed work should run. | 100 // The time at which delayed work should run. |
101 Time delayed_work_time_; | 101 TimeTicks delayed_work_time_; |
102 | 102 |
103 // A boolean value used to indicate if there is a kMsgDoWork message pending | 103 // A boolean value used to indicate if there is a kMsgDoWork message pending |
104 // in the Windows Message queue. There is at most one such message, and it | 104 // in the Windows Message queue. There is at most one such message, and it |
105 // can drive execution of tasks when a native message pump is running. | 105 // can drive execution of tasks when a native message pump is running. |
106 LONG have_work_; | 106 LONG have_work_; |
107 | 107 |
108 // State for the current invocation of Run. | 108 // State for the current invocation of Run. |
109 RunState* state_; | 109 RunState* state_; |
110 }; | 110 }; |
111 | 111 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 class MessagePumpForUI : public MessagePumpWin { | 160 class MessagePumpForUI : public MessagePumpWin { |
161 public: | 161 public: |
162 // The application-defined code passed to the hook procedure. | 162 // The application-defined code passed to the hook procedure. |
163 static const int kMessageFilterCode = 0x5001; | 163 static const int kMessageFilterCode = 0x5001; |
164 | 164 |
165 MessagePumpForUI(); | 165 MessagePumpForUI(); |
166 virtual ~MessagePumpForUI(); | 166 virtual ~MessagePumpForUI(); |
167 | 167 |
168 // MessagePump methods: | 168 // MessagePump methods: |
169 virtual void ScheduleWork(); | 169 virtual void ScheduleWork(); |
170 virtual void ScheduleDelayedWork(const Time& delayed_work_time); | 170 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); |
171 | 171 |
172 // Applications can call this to encourage us to process all pending WM_PAINT | 172 // Applications can call this to encourage us to process all pending WM_PAINT |
173 // messages. This method will process all paint messages the Windows Message | 173 // messages. This method will process all paint messages the Windows Message |
174 // queue can provide, up to some fixed number (to avoid any infinite loops). | 174 // queue can provide, up to some fixed number (to avoid any infinite loops). |
175 void PumpOutPendingPaintMessages(); | 175 void PumpOutPendingPaintMessages(); |
176 | 176 |
177 private: | 177 private: |
178 static LRESULT CALLBACK WndProcThunk( | 178 static LRESULT CALLBACK WndProcThunk( |
179 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | 179 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
180 virtual void DoRunLoop(); | 180 virtual void DoRunLoop(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 struct IOContext { | 312 struct IOContext { |
313 OVERLAPPED overlapped; | 313 OVERLAPPED overlapped; |
314 IOHandler* handler; | 314 IOHandler* handler; |
315 }; | 315 }; |
316 | 316 |
317 MessagePumpForIO(); | 317 MessagePumpForIO(); |
318 virtual ~MessagePumpForIO() {} | 318 virtual ~MessagePumpForIO() {} |
319 | 319 |
320 // MessagePump methods: | 320 // MessagePump methods: |
321 virtual void ScheduleWork(); | 321 virtual void ScheduleWork(); |
322 virtual void ScheduleDelayedWork(const Time& delayed_work_time); | 322 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); |
323 | 323 |
324 // Register the handler to be used when asynchronous IO for the given file | 324 // Register the handler to be used when asynchronous IO for the given file |
325 // completes. The registration persists as long as |file_handle| is valid, so | 325 // completes. The registration persists as long as |file_handle| is valid, so |
326 // |handler| must be valid as long as there is pending IO for the given file. | 326 // |handler| must be valid as long as there is pending IO for the given file. |
327 void RegisterIOHandler(HANDLE file_handle, IOHandler* handler); | 327 void RegisterIOHandler(HANDLE file_handle, IOHandler* handler); |
328 | 328 |
329 // Waits for the next IO completion that should be processed by |filter|, for | 329 // Waits for the next IO completion that should be processed by |filter|, for |
330 // up to |timeout| milliseconds. Return true if any IO operation completed, | 330 // up to |timeout| milliseconds. Return true if any IO operation completed, |
331 // regardless of the involved handler, and false if the timeout expired. If | 331 // regardless of the involved handler, and false if the timeout expired. If |
332 // the completion port received any message and the involved IO handler | 332 // the completion port received any message and the involved IO handler |
(...skipping 28 matching lines...) Expand all Loading... |
361 // This list will be empty almost always. It stores IO completions that have | 361 // This list will be empty almost always. It stores IO completions that have |
362 // not been delivered yet because somebody was doing cleanup. | 362 // not been delivered yet because somebody was doing cleanup. |
363 std::list<IOItem> completed_io_; | 363 std::list<IOItem> completed_io_; |
364 | 364 |
365 ObserverList<IOObserver> io_observers_; | 365 ObserverList<IOObserver> io_observers_; |
366 }; | 366 }; |
367 | 367 |
368 } // namespace base | 368 } // namespace base |
369 | 369 |
370 #endif // BASE_MESSAGE_PUMP_WIN_H_ | 370 #endif // BASE_MESSAGE_PUMP_WIN_H_ |
OLD | NEW |