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 | |
473 //----------------------------------------------------------------------------- | 468 //----------------------------------------------------------------------------- |
474 // MessagePumpForGpu private: | 469 // MessagePumpForGpu private: |
475 | 470 |
476 void MessagePumpForGpu::DoRunLoop() { | 471 void MessagePumpForGpu::DoRunLoop() { |
477 while (!state_->should_quit) { | 472 while (!state_->should_quit) { |
478 // Indicate that the loop is handling the work. | 473 // Indicate that the loop is handling the work. |
479 // If there is a race condition between switching to WORKING state here and | 474 // If there is a race condition between switching to WORKING state here and |
480 // the producer thread setting the HAVE_WORK state after exiting the wait, | 475 // the producer thread setting the HAVE_WORK state after exiting the wait, |
481 // the event might remain in the signalled state. That might be less than | 476 // the event might remain in the signalled state. That might be less than |
482 // optimal but wouldn't result in failing to handle the work. | 477 // optimal but wouldn't result in failing to handle the work. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 if (!filter || it->handler == filter) { | 732 if (!filter || it->handler == filter) { |
738 *item = *it; | 733 *item = *it; |
739 completed_io_.erase(it); | 734 completed_io_.erase(it); |
740 return true; | 735 return true; |
741 } | 736 } |
742 } | 737 } |
743 return false; | 738 return false; |
744 } | 739 } |
745 | 740 |
746 } // namespace base | 741 } // namespace base |
OLD | NEW |