| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 10 |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 463 |
| 464 WaitForWork(); // Wait (sleep) until we have work to do again. | 464 WaitForWork(); // Wait (sleep) until we have work to do again. |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 | 467 |
| 468 // Wait until IO completes, up to the time needed by the timer manager to fire | 468 // Wait until IO completes, up to the time needed by the timer manager to fire |
| 469 // the next set of timers. | 469 // the next set of timers. |
| 470 void MessagePumpForIO::WaitForWork() { | 470 void MessagePumpForIO::WaitForWork() { |
| 471 // We do not support nested IO message loops. This is to avoid messy | 471 // We do not support nested IO message loops. This is to avoid messy |
| 472 // recursion problems. | 472 // recursion problems. |
| 473 DCHECK(state_->run_depth == 1) << "Cannot nest an IO message loop!"; | 473 DCHECK_EQ(state_->run_depth, 1) << "Cannot nest an IO message loop!"; |
| 474 | 474 |
| 475 int timeout = GetCurrentDelay(); | 475 int timeout = GetCurrentDelay(); |
| 476 if (timeout < 0) // Negative value means no timers waiting. | 476 if (timeout < 0) // Negative value means no timers waiting. |
| 477 timeout = INFINITE; | 477 timeout = INFINITE; |
| 478 | 478 |
| 479 WaitForIOCompletion(timeout, NULL); | 479 WaitForIOCompletion(timeout, NULL); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool MessagePumpForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { | 482 bool MessagePumpForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { |
| 483 IOItem item; | 483 IOItem item; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 561 |
| 562 void MessagePumpForIO::WillProcessIOEvent() { | 562 void MessagePumpForIO::WillProcessIOEvent() { |
| 563 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); | 563 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void MessagePumpForIO::DidProcessIOEvent() { | 566 void MessagePumpForIO::DidProcessIOEvent() { |
| 567 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); | 567 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); |
| 568 } | 568 } |
| 569 | 569 |
| 570 } // namespace base | 570 } // namespace base |
| OLD | NEW |