| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LOOP_MESSAGE_PUMP_WIN_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ |
| 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/base_export.h" | 13 #include "base/base_export.h" |
| 14 #include "base/message_loop/message_pump.h" | 14 #include "base/message_loop/message_pump.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/win/message_window.h" |
| 16 #include "base/win/scoped_handle.h" | 17 #include "base/win/scoped_handle.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 | 20 |
| 20 // MessagePumpWin serves as the base for specialized versions of the MessagePump | 21 // MessagePumpWin serves as the base for specialized versions of the MessagePump |
| 21 // for Windows. It provides basic functionality like handling of observers and | 22 // for Windows. It provides basic functionality like handling of observers and |
| 22 // controlling the lifetime of the message pump. | 23 // controlling the lifetime of the message pump. |
| 23 class BASE_EXPORT MessagePumpWin : public MessagePump { | 24 class BASE_EXPORT MessagePumpWin : public MessagePump { |
| 24 public: | 25 public: |
| 25 MessagePumpWin(); | 26 MessagePumpWin(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { | 118 class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
| 118 public: | 119 public: |
| 119 MessagePumpForUI(); | 120 MessagePumpForUI(); |
| 120 ~MessagePumpForUI() override; | 121 ~MessagePumpForUI() override; |
| 121 | 122 |
| 122 // MessagePump methods: | 123 // MessagePump methods: |
| 123 void ScheduleWork() override; | 124 void ScheduleWork() override; |
| 124 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; | 125 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 static LRESULT CALLBACK WndProcThunk(HWND window_handle, | 128 bool MessageCallback( |
| 128 UINT message, | 129 UINT message, WPARAM wparam, LPARAM lparam, LRESULT* result); |
| 129 WPARAM wparam, | |
| 130 LPARAM lparam); | |
| 131 void DoRunLoop() override; | 130 void DoRunLoop() override; |
| 132 void InitMessageWnd(); | |
| 133 void WaitForWork(); | 131 void WaitForWork(); |
| 134 void HandleWorkMessage(); | 132 void HandleWorkMessage(); |
| 135 void HandleTimerMessage(); | 133 void HandleTimerMessage(); |
| 136 void RescheduleTimer(); | 134 void RescheduleTimer(); |
| 137 bool ProcessNextWindowsMessage(); | 135 bool ProcessNextWindowsMessage(); |
| 138 bool ProcessMessageHelper(const MSG& msg); | 136 bool ProcessMessageHelper(const MSG& msg); |
| 139 bool ProcessPumpReplacementMessage(); | 137 bool ProcessPumpReplacementMessage(); |
| 140 | 138 |
| 141 // Atom representing the registered window class. | 139 base::win::MessageWindow message_window_; |
| 142 ATOM atom_; | |
| 143 | |
| 144 // A hidden message-only window. | |
| 145 HWND message_hwnd_; | |
| 146 }; | 140 }; |
| 147 | 141 |
| 148 //----------------------------------------------------------------------------- | 142 //----------------------------------------------------------------------------- |
| 149 // MessagePumpForGpu is a simplified version of UI message pump that is | 143 // MessagePumpForGpu is a simplified version of UI message pump that is |
| 150 // optimized for the GPU process. Unlike MessagePumpForUI it doesn't have a | 144 // optimized for the GPU process. Unlike MessagePumpForUI it doesn't have a |
| 151 // hidden window and doesn't handle a situation where a native message pump | 145 // hidden window and doesn't handle a situation where a native message pump |
| 152 // might take over message processing. | 146 // might take over message processing. |
| 153 // | 147 // |
| 154 class BASE_EXPORT MessagePumpForGpu : public MessagePumpWin { | 148 class BASE_EXPORT MessagePumpForGpu : public MessagePumpWin { |
| 155 public: | 149 public: |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // The completion port associated with this thread. | 278 // The completion port associated with this thread. |
| 285 win::ScopedHandle port_; | 279 win::ScopedHandle port_; |
| 286 // This list will be empty almost always. It stores IO completions that have | 280 // This list will be empty almost always. It stores IO completions that have |
| 287 // not been delivered yet because somebody was doing cleanup. | 281 // not been delivered yet because somebody was doing cleanup. |
| 288 std::list<IOItem> completed_io_; | 282 std::list<IOItem> completed_io_; |
| 289 }; | 283 }; |
| 290 | 284 |
| 291 } // namespace base | 285 } // namespace base |
| 292 | 286 |
| 293 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ | 287 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ |
| OLD | NEW |