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> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void HandleTimerMessage(); | 133 void HandleTimerMessage(); |
134 void RescheduleTimer(); | 134 void RescheduleTimer(); |
135 bool ProcessNextWindowsMessage(); | 135 bool ProcessNextWindowsMessage(); |
136 bool ProcessMessageHelper(const MSG& msg); | 136 bool ProcessMessageHelper(const MSG& msg); |
137 bool ProcessPumpReplacementMessage(); | 137 bool ProcessPumpReplacementMessage(); |
138 | 138 |
139 base::win::MessageWindow message_window_; | 139 base::win::MessageWindow message_window_; |
140 }; | 140 }; |
141 | 141 |
142 //----------------------------------------------------------------------------- | 142 //----------------------------------------------------------------------------- |
143 // MessagePumpForGpu is a simplified version of UI message pump that is | |
144 // optimized for the GPU process. Unlike MessagePumpForUI it doesn't have a | |
145 // hidden window and doesn't handle a situation where a native message pump | |
146 // might take over message processing. | |
147 // | |
148 class BASE_EXPORT MessagePumpForGpu : public MessagePumpWin { | |
149 public: | |
150 MessagePumpForGpu(); | |
151 ~MessagePumpForGpu() override; | |
152 | |
153 // Factory methods. | |
154 static void InitFactory(); | |
155 static std::unique_ptr<MessagePump> CreateMessagePumpForGpu(); | |
156 | |
157 // MessagePump methods: | |
158 void ScheduleWork() override; | |
159 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; | |
160 | |
161 private: | |
162 // MessagePumpWin methods: | |
163 void DoRunLoop() override; | |
164 | |
165 void WaitForWork(); | |
166 bool ProcessNextMessage(); | |
167 | |
168 win::ScopedHandle event_; | |
169 | |
170 // Used to help diagnose hangs. | |
171 // TODO(stanisc): crbug.com/596190: Remove these once the bug is fixed. | |
172 TimeTicks last_set_event_timeticks_; | |
173 }; | |
174 | |
175 //----------------------------------------------------------------------------- | |
176 // MessagePumpForIO extends MessagePumpWin with methods that are particular to a | 143 // MessagePumpForIO extends MessagePumpWin with methods that are particular to a |
177 // MessageLoop instantiated with TYPE_IO. This version of MessagePump does not | 144 // MessageLoop instantiated with TYPE_IO. This version of MessagePump does not |
178 // deal with Windows mesagges, and instead has a Run loop based on Completion | 145 // deal with Windows mesagges, and instead has a Run loop based on Completion |
179 // Ports so it is better suited for IO operations. | 146 // Ports so it is better suited for IO operations. |
180 // | 147 // |
181 class BASE_EXPORT MessagePumpForIO : public MessagePumpWin { | 148 class BASE_EXPORT MessagePumpForIO : public MessagePumpWin { |
182 public: | 149 public: |
183 struct BASE_EXPORT IOContext { | 150 struct BASE_EXPORT IOContext { |
184 IOContext(); | 151 IOContext(); |
185 OVERLAPPED overlapped; | 152 OVERLAPPED overlapped; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // The completion port associated with this thread. | 245 // The completion port associated with this thread. |
279 win::ScopedHandle port_; | 246 win::ScopedHandle port_; |
280 // This list will be empty almost always. It stores IO completions that have | 247 // This list will be empty almost always. It stores IO completions that have |
281 // not been delivered yet because somebody was doing cleanup. | 248 // not been delivered yet because somebody was doing cleanup. |
282 std::list<IOItem> completed_io_; | 249 std::list<IOItem> completed_io_; |
283 }; | 250 }; |
284 | 251 |
285 } // namespace base | 252 } // namespace base |
286 | 253 |
287 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ | 254 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ |
OLD | NEW |