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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 void MessagePumpForGpu::ScheduleDelayedWork( | 548 void MessagePumpForGpu::ScheduleDelayedWork( |
549 const TimeTicks& delayed_work_time) { | 549 const TimeTicks& delayed_work_time) { |
550 // We know that we can't be blocked right now since this method can only be | 550 // We know that we can't be blocked right now since this method can only be |
551 // called on the same thread as Run, so we only need to update our record of | 551 // called on the same thread as Run, so we only need to update our record of |
552 // how long to sleep when we do sleep. | 552 // how long to sleep when we do sleep. |
553 delayed_work_time_ = delayed_work_time; | 553 delayed_work_time_ = delayed_work_time; |
554 } | 554 } |
555 | 555 |
556 bool MessagePumpForGpu::WasSignaled() { | |
557 // If |event_| was set this would reset it back to unset state. | |
558 return WaitForSingleObject(event_.Get(), 0) == WAIT_OBJECT_0; | |
559 } | |
560 | |
561 //----------------------------------------------------------------------------- | 556 //----------------------------------------------------------------------------- |
562 // MessagePumpForGpu private: | 557 // MessagePumpForGpu private: |
563 | 558 |
564 void MessagePumpForGpu::DoRunLoop() { | 559 void MessagePumpForGpu::DoRunLoop() { |
565 while (!state_->should_quit) { | 560 while (!state_->should_quit) { |
566 // Indicate that the loop is handling the work. | 561 // Indicate that the loop is handling the work. |
567 // If there is a race condition between switching to WORKING state here and | 562 // If there is a race condition between switching to WORKING state here and |
568 // the producer thread setting the HAVE_WORK state after exiting the wait, | 563 // the producer thread setting the HAVE_WORK state after exiting the wait, |
569 // the event might remain in the signalled state. That might be less than | 564 // the event might remain in the signalled state. That might be less than |
570 // optimal but wouldn't result in failing to handle the work. | 565 // optimal but wouldn't result in failing to handle the work. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 if (!filter || it->handler == filter) { | 823 if (!filter || it->handler == filter) { |
829 *item = *it; | 824 *item = *it; |
830 completed_io_.erase(it); | 825 completed_io_.erase(it); |
831 return true; | 826 return true; |
832 } | 827 } |
833 } | 828 } |
834 return false; | 829 return false; |
835 } | 830 } |
836 | 831 |
837 } // namespace base | 832 } // namespace base |
OLD | NEW |