Index: cc/scheduler/scheduler_state_machine.cc |
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc |
index c3a4a1e272a5a6006ac49548dea5b206cdb40a0b..7bce7eec5930513c1312f10b8fa18e64c572304a 100644 |
--- a/cc/scheduler/scheduler_state_machine.cc |
+++ b/cc/scheduler/scheduler_state_machine.cc |
@@ -4,11 +4,11 @@ |
#include "cc/scheduler/scheduler_state_machine.h" |
-#include "base/debug/trace_event.h" |
-#include "base/debug/trace_event_argument.h" |
#include "base/format_macros.h" |
#include "base/logging.h" |
#include "base/strings/stringprintf.h" |
+#include "base/trace_event/trace_event.h" |
+#include "base/trace_event/trace_event_argument.h" |
#include "base/values.h" |
#include "ui/gfx/frame_time.h" |
@@ -48,7 +48,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
skip_begin_main_frame_to_reduce_latency_(false), |
continuous_painting_(false), |
impl_latency_takes_priority_on_battery_(false), |
- children_need_begin_frames_(false) { |
+ children_need_begin_frames_(false), |
+ defer_commits_(false) { |
} |
const char* SchedulerStateMachine::OutputSurfaceStateToString( |
@@ -238,6 +239,7 @@ void SchedulerStateMachine::AsValueInto(base::debug::TracedValue* state, |
state->SetBoolean("impl_latency_takes_priority_on_battery", |
impl_latency_takes_priority_on_battery_); |
state->SetBoolean("children_need_begin_frames", children_need_begin_frames_); |
+ state->SetBoolean("defer_commits", defer_commits_); |
state->EndDictionary(); |
} |
@@ -414,6 +416,10 @@ bool SchedulerStateMachine::CouldSendBeginMainFrame() const { |
if (!visible_) |
return false; |
+ // Do not make a new commits when it is deferred. |
+ if (defer_commits_) |
+ return false; |
+ |
return true; |
} |
@@ -769,6 +775,10 @@ void SchedulerStateMachine::SetChildrenNeedBeginFrames( |
children_need_begin_frames_ = children_need_begin_frames; |
} |
+void SchedulerStateMachine::SetDeferCommits(bool defer_commits) { |
+ defer_commits_ = defer_commits; |
+} |
+ |
// These are the cases where we definitely (or almost definitely) have a |
// new frame to animate and/or draw and can draw. |
bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
@@ -1052,6 +1062,7 @@ void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
switch (reason) { |
case CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST: |
case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: |
+ case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: |
commit_state_ = COMMIT_STATE_IDLE; |
SetNeedsCommit(); |
return; |