Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 2354673003: Add setting to disable latency recovery for tests (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/scheduler/scheduler_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 compositor_timing_history_->SetRecordingEnabled( 749 compositor_timing_history_->SetRecordingEnabled(
750 state_machine_.HasInitializedCompositorFrameSink() && 750 state_machine_.HasInitializedCompositorFrameSink() &&
751 state_machine_.visible()); 751 state_machine_.visible());
752 } 752 }
753 753
754 bool Scheduler::ShouldRecoverMainLatency( 754 bool Scheduler::ShouldRecoverMainLatency(
755 const BeginFrameArgs& args, 755 const BeginFrameArgs& args,
756 bool can_activate_before_deadline) const { 756 bool can_activate_before_deadline) const {
757 DCHECK(!settings_.using_synchronous_renderer_compositor); 757 DCHECK(!settings_.using_synchronous_renderer_compositor);
758 758
759 if (!settings_.enable_latency_recovery)
760 return false;
761
759 // The main thread is in a low latency mode and there's no need to recover. 762 // The main thread is in a low latency mode and there's no need to recover.
760 if (!state_machine_.main_thread_missed_last_deadline()) 763 if (!state_machine_.main_thread_missed_last_deadline())
761 return false; 764 return false;
762 765
763 // When prioritizing impl thread latency, we currently put the 766 // When prioritizing impl thread latency, we currently put the
764 // main thread in a high latency mode. Don't try to fight it. 767 // main thread in a high latency mode. Don't try to fight it.
765 if (state_machine_.ImplLatencyTakesPriority()) 768 if (state_machine_.ImplLatencyTakesPriority())
766 return false; 769 return false;
767 770
768 return can_activate_before_deadline; 771 return can_activate_before_deadline;
769 } 772 }
770 773
771 bool Scheduler::ShouldRecoverImplLatency( 774 bool Scheduler::ShouldRecoverImplLatency(
772 const BeginFrameArgs& args, 775 const BeginFrameArgs& args,
773 bool can_activate_before_deadline) const { 776 bool can_activate_before_deadline) const {
774 DCHECK(!settings_.using_synchronous_renderer_compositor); 777 DCHECK(!settings_.using_synchronous_renderer_compositor);
775 778
779 if (!settings_.enable_latency_recovery)
780 return false;
781
776 // Disable impl thread latency recovery when using the unthrottled 782 // Disable impl thread latency recovery when using the unthrottled
777 // begin frame source since we will always get a BeginFrame before 783 // begin frame source since we will always get a BeginFrame before
778 // the swap ack and our heuristics below will not work. 784 // the swap ack and our heuristics below will not work.
779 if (begin_frame_source_ && !begin_frame_source_->IsThrottled()) 785 if (begin_frame_source_ && !begin_frame_source_->IsThrottled())
780 return false; 786 return false;
781 787
782 // If we are swap throttled at the BeginFrame, that means the impl thread is 788 // If we are swap throttled at the BeginFrame, that means the impl thread is
783 // very likely in a high latency mode. 789 // very likely in a high latency mode.
784 bool impl_thread_is_likely_high_latency = state_machine_.SwapThrottled(); 790 bool impl_thread_is_likely_high_latency = state_machine_.SwapThrottled();
785 if (!impl_thread_is_likely_high_latency) 791 if (!impl_thread_is_likely_high_latency)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } 823 }
818 824
819 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 825 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
820 return (state_machine_.begin_main_frame_state() == 826 return (state_machine_.begin_main_frame_state() ==
821 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || 827 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT ||
822 state_machine_.begin_main_frame_state() == 828 state_machine_.begin_main_frame_state() ==
823 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); 829 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED);
824 } 830 }
825 831
826 } // namespace cc 832 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/scheduler_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698