OLD | NEW |
1 // Copyright (c) 2011 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 #include "base/win/wrapped_window_proc.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // run loop itself. | 115 // run loop itself. |
116 // | 116 // |
117 // We use a single SetTimer corresponding to the timer that will expire | 117 // We use a single SetTimer corresponding to the timer that will expire |
118 // soonest. As new timers are created and destroyed, we update SetTimer. | 118 // soonest. As new timers are created and destroyed, we update SetTimer. |
119 // Getting a spurrious SetTimer event firing is benign, as we'll just be | 119 // Getting a spurrious SetTimer event firing is benign, as we'll just be |
120 // processing an empty timer queue. | 120 // processing an empty timer queue. |
121 // | 121 // |
122 delayed_work_time_ = delayed_work_time; | 122 delayed_work_time_ = delayed_work_time; |
123 | 123 |
124 int delay_msec = GetCurrentDelay(); | 124 int delay_msec = GetCurrentDelay(); |
125 DCHECK(delay_msec >= 0); | 125 DCHECK_GE(delay_msec, 0); |
126 if (delay_msec < USER_TIMER_MINIMUM) | 126 if (delay_msec < USER_TIMER_MINIMUM) |
127 delay_msec = USER_TIMER_MINIMUM; | 127 delay_msec = USER_TIMER_MINIMUM; |
128 | 128 |
129 // Create a WM_TIMER event that will wake us up to check for any pending | 129 // Create a WM_TIMER event that will wake us up to check for any pending |
130 // timers (in case we are running within a nested, external sub-pump). | 130 // timers (in case we are running within a nested, external sub-pump). |
131 SetTimer(message_hwnd_, reinterpret_cast<UINT_PTR>(this), delay_msec, NULL); | 131 SetTimer(message_hwnd_, reinterpret_cast<UINT_PTR>(this), delay_msec, NULL); |
132 } | 132 } |
133 | 133 |
134 void MessagePumpForUI::PumpOutPendingPaintMessages() { | 134 void MessagePumpForUI::PumpOutPendingPaintMessages() { |
135 // If we are being called outside of the context of Run, then don't try to do | 135 // If we are being called outside of the context of Run, then don't try to do |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 562 |
563 void MessagePumpForIO::WillProcessIOEvent() { | 563 void MessagePumpForIO::WillProcessIOEvent() { |
564 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); | 564 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); |
565 } | 565 } |
566 | 566 |
567 void MessagePumpForIO::DidProcessIOEvent() { | 567 void MessagePumpForIO::DidProcessIOEvent() { |
568 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); | 568 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); |
569 } | 569 } |
570 | 570 |
571 } // namespace base | 571 } // namespace base |
OLD | NEW |