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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 54913003: Scheduler: Switch from high to low latency mode if possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming and comments. Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_state_machine.cc
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 0fd0f57b3b25b8466f8479c933ac10c89db314a7..90d419b0a35ad60ccfcd817d2646aad2907e7147 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -41,7 +41,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
active_tree_needs_first_draw_(false),
draw_if_possible_failed_(false),
did_create_and_initialize_first_output_surface_(false),
- smoothness_takes_priority_(false) {}
+ smoothness_takes_priority_(false),
+ skip_begin_main_frame_to_reduce_latency_(false) {}
const char* SchedulerStateMachine::OutputSurfaceStateToString(
OutputSurfaceState state) {
@@ -259,6 +260,8 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const {
did_create_and_initialize_first_output_surface_);
minor_state->SetBoolean("smoothness_takes_priority",
smoothness_takes_priority_);
+ minor_state->SetBoolean("skip_begin_main_frame_to_reduce_latency",
+ skip_begin_main_frame_to_reduce_latency_);
state->Set("minor_state", minor_state.release());
return state.PassAs<base::Value>();
@@ -485,6 +488,9 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
if (!HasInitializedOutputSurface())
return false;
+ if (skip_begin_main_frame_to_reduce_latency_)
+ return false;
+
return true;
}
@@ -756,6 +762,10 @@ void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() {
main_thread_needs_layer_textures_ = true;
}
+void SchedulerStateMachine::SetSkipBeginMainFrameToReduceLatency(bool skip) {
+ skip_begin_main_frame_to_reduce_latency_ = skip;
+}
+
bool SchedulerStateMachine::BeginImplFrameNeeded() const {
// Proactive BeginImplFrames are bad for the synchronous compositor because we
// have to draw when we get the BeginImplFrame and could end up drawing many
@@ -919,6 +929,29 @@ bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineEarly() const {
return false;
}
+bool SchedulerStateMachine::InHighLatencyMode() const {
brianderson 2013/11/01 21:18:30 Maybe rename this to MainThreadIsInHighLatencyMode
+ // We're in high latency mode if there's something to draw from the previous
+ // frame at the start of BeginImplFrame.
+ if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING)
brianderson 2013/11/01 21:18:30 Can you add the result of this method to the outpu
+ return false;
+
+ // There's an ongoing commit at the start of BeginImplFrame whose output needs
+ // to be drawn before another commit from the main thread.
+ if (commit_state_ != COMMIT_STATE_IDLE)
+ return true;
+
+ // There is a pending tree from the previous frame which needs to be activated
+ // and drawn before producing a new tree.
+ if (has_pending_tree_ )
+ return true;
+
+ // A newly activated tree from the previous frame needs to be drawn.
+ if (active_tree_needs_first_draw_)
brianderson 2013/11/01 21:18:30 To make this method valid regardless of the state
+ return true;
+
+ return false;
+}
+
void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() {
current_frame_number_++;
inside_poll_for_anticipated_draw_triggers_ = true;
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698