OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // main thread in a high latency mode. Don't try to fight it. | 761 // main thread in a high latency mode. Don't try to fight it. |
762 if (state_machine_.impl_latency_takes_priority()) | 762 if (state_machine_.impl_latency_takes_priority()) |
763 return false; | 763 return false; |
764 | 764 |
765 return CanCommitAndActivateBeforeDeadline(args); | 765 return CanCommitAndActivateBeforeDeadline(args); |
766 } | 766 } |
767 | 767 |
768 bool Scheduler::ShouldRecoverImplLatency(const BeginFrameArgs& args) const { | 768 bool Scheduler::ShouldRecoverImplLatency(const BeginFrameArgs& args) const { |
769 DCHECK(!settings_.using_synchronous_renderer_compositor); | 769 DCHECK(!settings_.using_synchronous_renderer_compositor); |
770 | 770 |
| 771 // Disable impl thread latency recovery when using the unthrottled |
| 772 // begin frame source since we will always get a BeginFrame before |
| 773 // the swap ack and our heuristics below will not work. |
| 774 if (!throttle_frame_production_) |
| 775 return false; |
| 776 |
771 // If we are swap throttled at the BeginFrame, that means the impl thread is | 777 // If we are swap throttled at the BeginFrame, that means the impl thread is |
772 // very likely in a high latency mode. | 778 // very likely in a high latency mode. |
773 bool impl_thread_is_likely_high_latency = state_machine_.SwapThrottled(); | 779 bool impl_thread_is_likely_high_latency = state_machine_.SwapThrottled(); |
774 if (!impl_thread_is_likely_high_latency) | 780 if (!impl_thread_is_likely_high_latency) |
775 return false; | 781 return false; |
776 | 782 |
777 // The deadline may be in the past if our draw time is too long. | 783 // The deadline may be in the past if our draw time is too long. |
778 bool can_draw_before_deadline = args.frame_time < args.deadline; | 784 bool can_draw_before_deadline = args.frame_time < args.deadline; |
779 | 785 |
780 // When prioritizing impl thread latency, the deadline doesn't wait | 786 // When prioritizing impl thread latency, the deadline doesn't wait |
(...skipping 27 matching lines...) Expand all Loading... |
808 } | 814 } |
809 | 815 |
810 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 816 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
811 return (state_machine_.commit_state() == | 817 return (state_machine_.commit_state() == |
812 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 818 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
813 state_machine_.commit_state() == | 819 state_machine_.commit_state() == |
814 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 820 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
815 } | 821 } |
816 | 822 |
817 } // namespace cc | 823 } // namespace cc |
OLD | NEW |