| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/message_pump_win.h" | 5 #include "base/message_pump_win.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/win/wrapped_window_proc.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 | 13 |
| 13 static const wchar_t kWndClass[] = L"Chrome_MessagePumpWindow"; | 14 static const wchar_t kWndClass[] = L"Chrome_MessagePumpWindow"; |
| 14 | 15 |
| 15 // Message sent to get an additional time slice for pumping (processing) another | 16 // Message sent to get an additional time slice for pumping (processing) another |
| 16 // task (a series of such messages creates a continuous task pump). | 17 // task (a series of such messages creates a continuous task pump). |
| 17 static const int kMsgHaveWork = WM_USER + 1; | 18 static const int kMsgHaveWork = WM_USER + 1; |
| 18 | 19 |
| 19 //----------------------------------------------------------------------------- | 20 //----------------------------------------------------------------------------- |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 226 |
| 226 WaitForWork(); // Wait (sleep) until we have work to do again. | 227 WaitForWork(); // Wait (sleep) until we have work to do again. |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 | 230 |
| 230 void MessagePumpForUI::InitMessageWnd() { | 231 void MessagePumpForUI::InitMessageWnd() { |
| 231 HINSTANCE hinst = GetModuleHandle(NULL); | 232 HINSTANCE hinst = GetModuleHandle(NULL); |
| 232 | 233 |
| 233 WNDCLASSEX wc = {0}; | 234 WNDCLASSEX wc = {0}; |
| 234 wc.cbSize = sizeof(wc); | 235 wc.cbSize = sizeof(wc); |
| 235 wc.lpfnWndProc = WndProcThunk; | 236 wc.lpfnWndProc = base::win::WrappedWindowProc<WndProcThunk>; |
| 236 wc.hInstance = hinst; | 237 wc.hInstance = hinst; |
| 237 wc.lpszClassName = kWndClass; | 238 wc.lpszClassName = kWndClass; |
| 238 RegisterClassEx(&wc); | 239 RegisterClassEx(&wc); |
| 239 | 240 |
| 240 message_hwnd_ = | 241 message_hwnd_ = |
| 241 CreateWindow(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); | 242 CreateWindow(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); |
| 242 DCHECK(message_hwnd_); | 243 DCHECK(message_hwnd_); |
| 243 } | 244 } |
| 244 | 245 |
| 245 void MessagePumpForUI::WaitForWork() { | 246 void MessagePumpForUI::WaitForWork() { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 562 |
| 562 void MessagePumpForIO::WillProcessIOEvent() { | 563 void MessagePumpForIO::WillProcessIOEvent() { |
| 563 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); | 564 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); |
| 564 } | 565 } |
| 565 | 566 |
| 566 void MessagePumpForIO::DidProcessIOEvent() { | 567 void MessagePumpForIO::DidProcessIOEvent() { |
| 567 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); | 568 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); |
| 568 } | 569 } |
| 569 | 570 |
| 570 } // namespace base | 571 } // namespace base |
| OLD | NEW |