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 #include "base/message_loop/message_pump_win.h" | 5 #include "base/message_loop/message_pump_win.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 458 } |
459 | 459 |
460 void MessagePumpForGpu::ScheduleDelayedWork( | 460 void MessagePumpForGpu::ScheduleDelayedWork( |
461 const TimeTicks& delayed_work_time) { | 461 const TimeTicks& delayed_work_time) { |
462 // We know that we can't be blocked right now since this method can only be | 462 // We know that we can't be blocked right now since this method can only be |
463 // called on the same thread as Run, so we only need to update our record of | 463 // called on the same thread as Run, so we only need to update our record of |
464 // how long to sleep when we do sleep. | 464 // how long to sleep when we do sleep. |
465 delayed_work_time_ = delayed_work_time; | 465 delayed_work_time_ = delayed_work_time; |
466 } | 466 } |
467 | 467 |
| 468 bool MessagePumpForGpu::WasSignaled() { |
| 469 // If |event_| was set this would reset it back to unset state. |
| 470 return WaitForSingleObject(event_, 0) == WAIT_OBJECT_0; |
| 471 } |
| 472 |
468 //----------------------------------------------------------------------------- | 473 //----------------------------------------------------------------------------- |
469 // MessagePumpForGpu private: | 474 // MessagePumpForGpu private: |
470 | 475 |
471 void MessagePumpForGpu::DoRunLoop() { | 476 void MessagePumpForGpu::DoRunLoop() { |
472 while (!state_->should_quit) { | 477 while (!state_->should_quit) { |
473 // Indicate that the loop is handling the work. | 478 // Indicate that the loop is handling the work. |
474 // If there is a race condition between switching to WORKING state here and | 479 // If there is a race condition between switching to WORKING state here and |
475 // the producer thread setting the HAVE_WORK state after exiting the wait, | 480 // the producer thread setting the HAVE_WORK state after exiting the wait, |
476 // the event might remain in the signalled state. That might be less than | 481 // the event might remain in the signalled state. That might be less than |
477 // optimal but wouldn't result in failing to handle the work. | 482 // optimal but wouldn't result in failing to handle the work. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 if (!filter || it->handler == filter) { | 737 if (!filter || it->handler == filter) { |
733 *item = *it; | 738 *item = *it; |
734 completed_io_.erase(it); | 739 completed_io_.erase(it); |
735 return true; | 740 return true; |
736 } | 741 } |
737 } | 742 } |
738 return false; | 743 return false; |
739 } | 744 } |
740 | 745 |
741 } // namespace base | 746 } // namespace base |
OLD | NEW |