| Index: cc/scheduler/scheduler_state_machine.cc
|
| diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
|
| index 189387cf12856f1fc348c605a976d1422aaf705c..ca943f3c0af7be3ce90174b0f835d989de3884e9 100644
|
| --- a/cc/scheduler/scheduler_state_machine.cc
|
| +++ b/cc/scheduler/scheduler_state_machine.cc
|
| @@ -23,6 +23,7 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
|
| commit_count_(0),
|
| current_frame_number_(0),
|
| last_frame_number_animate_performed_(-1),
|
| + last_frame_number_custom_mutate_performed_(-1),
|
| last_frame_number_swap_performed_(-1),
|
| last_frame_number_swap_requested_(-1),
|
| last_frame_number_begin_main_frame_sent_(-1),
|
| @@ -126,6 +127,8 @@ const char* SchedulerStateMachine::ActionToString(Action action) {
|
| return "ACTION_NONE";
|
| case ACTION_ANIMATE:
|
| return "ACTION_ANIMATE";
|
| + case ACTION_CUSTOM_MUTATE:
|
| + return "ACTION_CUSTOM_MUTATE";
|
| case ACTION_SEND_BEGIN_MAIN_FRAME:
|
| return "ACTION_SEND_BEGIN_MAIN_FRAME";
|
| case ACTION_COMMIT:
|
| @@ -199,6 +202,8 @@ void SchedulerStateMachine::AsValueInto(base::trace_event::TracedValue* state,
|
|
|
| state->SetInteger("last_frame_number_animate_performed",
|
| last_frame_number_animate_performed_);
|
| + state->SetInteger("last_frame_number_custom_mutate_performed",
|
| + last_frame_number_custom_mutate_performed_);
|
| state->SetInteger("last_frame_number_swap_performed",
|
| last_frame_number_swap_performed_);
|
| state->SetInteger("last_frame_number_swap_requested",
|
| @@ -256,6 +261,10 @@ bool SchedulerStateMachine::HasAnimatedThisFrame() const {
|
| return last_frame_number_animate_performed_ == current_frame_number_;
|
| }
|
|
|
| +bool SchedulerStateMachine::HasCustomMutatedThisFrame() const {
|
| + return last_frame_number_custom_mutate_performed_ == current_frame_number_;
|
| +}
|
| +
|
| bool SchedulerStateMachine::HasSentBeginMainFrameThisFrame() const {
|
| return current_frame_number_ ==
|
| last_frame_number_begin_main_frame_sent_;
|
| @@ -405,6 +414,21 @@ bool SchedulerStateMachine::ShouldAnimate() const {
|
| return needs_redraw_ || needs_animate_;
|
| }
|
|
|
| +bool SchedulerStateMachine::ShouldCustomMutate() const {
|
| + // Don't mutate if we are waiting on the first commit after a surface.
|
| + if (output_surface_state_ != OUTPUT_SURFACE_ACTIVE)
|
| + return false;
|
| +
|
| + if (HasCustomMutatedThisFrame() || !needs_custom_mutate_)
|
| + return false;
|
| +
|
| + if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING &&
|
| + begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| bool SchedulerStateMachine::CouldSendBeginMainFrame() const {
|
| if (!needs_commit_)
|
| return false;
|
| @@ -511,6 +535,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
|
| return ACTION_COMMIT;
|
| if (ShouldAnimate())
|
| return ACTION_ANIMATE;
|
| + if (ShouldCustomMutate())
|
| + return ACTION_CUSTOM_MUTATE;
|
| if (ShouldDraw()) {
|
| if (PendingDrawsShouldBeAborted())
|
| return ACTION_DRAW_AND_SWAP_ABORT;
|
| @@ -546,6 +572,11 @@ void SchedulerStateMachine::UpdateState(Action action) {
|
| SetNeedsRedraw();
|
| return;
|
|
|
| + case ACTION_CUSTOM_MUTATE:
|
| + last_frame_number_custom_mutate_performed_ = current_frame_number_;
|
| + needs_custom_mutate_ = false;
|
| + return;
|
| +
|
| case ACTION_SEND_BEGIN_MAIN_FRAME:
|
| DCHECK(!has_pending_tree_ ||
|
| settings_.main_frame_before_activation_enabled);
|
| @@ -962,6 +993,10 @@ void SchedulerStateMachine::SetNeedsAnimate() {
|
| needs_animate_ = true;
|
| }
|
|
|
| +void SchedulerStateMachine::SetNeedsCustomMutate() {
|
| + needs_custom_mutate_ = true;
|
| +}
|
| +
|
| void SchedulerStateMachine::SetNeedsPrepareTiles() {
|
| if (!needs_prepare_tiles_) {
|
| TRACE_EVENT0("cc", "SchedulerStateMachine::SetNeedsPrepareTiles");
|
|
|