Update from chromium https://crrev.com/301725/
This updates DEPS to reflect changes in 301725 /
90a7c4e3fdeb82a18e17f24e56345b9086a8308b, imports changes, and adds
a patch file for our ui/gl/gl_surface modifications.
Review URL: https://codereview.chromium.org/669813003
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 6a412dc..2b8210d 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -43,6 +43,7 @@
has_pending_tree_(false),
pending_tree_is_ready_for_activation_(false),
active_tree_needs_first_draw_(false),
+ did_commit_after_animating_(false),
did_create_and_initialize_first_output_surface_(false),
impl_latency_takes_priority_(false),
skip_next_begin_main_frame_to_reduce_latency_(false),
@@ -226,6 +227,7 @@
pending_tree_is_ready_for_activation_);
state->SetBoolean("active_tree_needs_first_draw",
active_tree_needs_first_draw_);
+ state->SetBoolean("did_commit_after_animating", did_commit_after_animating_);
state->SetBoolean("did_create_and_initialize_first_output_surface",
did_create_and_initialize_first_output_surface_);
state->SetBoolean("impl_latency_takes_priority",
@@ -254,6 +256,10 @@
skip_next_begin_main_frame_to_reduce_latency_ = false;
}
+bool SchedulerStateMachine::HasAnimatedThisFrame() const {
+ return last_frame_number_animate_performed_ == current_frame_number_;
+}
+
bool SchedulerStateMachine::HasSentBeginMainFrameThisFrame() const {
return current_frame_number_ ==
last_frame_number_begin_main_frame_sent_;
@@ -344,6 +350,11 @@
if (PendingDrawsShouldBeAborted())
return active_tree_needs_first_draw_;
+ // If a commit has occurred after the animate call, we need to call animate
+ // again before we should draw.
+ if (did_commit_after_animating_)
+ return false;
+
// After this line, we only want to send a swap request once per frame.
if (HasRequestedSwapThisFrame())
return false;
@@ -415,7 +426,8 @@
if (!can_draw_)
return false;
- if (last_frame_number_animate_performed_ == current_frame_number_)
+ // If a commit occurred after our last call, we need to do animation again.
+ if (HasAnimatedThisFrame() && !did_commit_after_animating_)
return false;
if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING &&
@@ -567,6 +579,7 @@
case ACTION_ANIMATE:
last_frame_number_animate_performed_ = current_frame_number_;
needs_animate_ = false;
+ did_commit_after_animating_ = false;
// TODO(skyostil): Instead of assuming this, require the client to tell
// us.
SetNeedsRedraw();
@@ -622,6 +635,9 @@
void SchedulerStateMachine::UpdateStateOnCommit(bool commit_was_aborted) {
commit_count_++;
+ if (!commit_was_aborted && HasAnimatedThisFrame())
+ did_commit_after_animating_ = true;
+
if (commit_was_aborted || settings_.main_frame_before_activation_enabled) {
commit_state_ = COMMIT_STATE_IDLE;
} else {
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 0bcb323..a63a683 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -266,6 +266,7 @@
bool ShouldManageTiles() const;
void AdvanceCurrentFrameNumber();
+ bool HasAnimatedThisFrame() const;
bool HasSentBeginMainFrameThisFrame() const;
bool HasUpdatedVisibleTilesThisFrame() const;
bool HasRequestedSwapThisFrame() const;
@@ -313,6 +314,7 @@
bool has_pending_tree_;
bool pending_tree_is_ready_for_activation_;
bool active_tree_needs_first_draw_;
+ bool did_commit_after_animating_;
bool did_create_and_initialize_first_output_surface_;
bool impl_latency_takes_priority_;
bool skip_next_begin_main_frame_to_reduce_latency_;
diff --git a/cc/scheduler/scheduler_state_machine_unittest.cc b/cc/scheduler/scheduler_state_machine_unittest.cc
index fc82fb6..e3530c8 100644
--- a/cc/scheduler/scheduler_state_machine_unittest.cc
+++ b/cc/scheduler/scheduler_state_machine_unittest.cc
@@ -1761,6 +1761,39 @@
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
}
+TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) {
+ SchedulerSettings settings;
+ settings.impl_side_painting = true;
+ StateMachine state(settings);
+ state.SetCanStart();
+ state.UpdateState(state.NextAction());
+ state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
+ state.SetVisible(true);
+ state.SetCanDraw(true);
+
+ // Check that animations are updated before we start a commit.
+ state.SetNeedsAnimate();
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
+ state.SetNeedsCommit();
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
+ EXPECT_TRUE(state.BeginFrameNeeded());
+
+ state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
+ EXPECT_ACTION_UPDATE_STATE(
+ SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
+
+ state.NotifyBeginMainFrameStarted();
+ state.NotifyReadyToCommit();
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
+
+ state.OnBeginImplFrameDeadlinePending();
+ state.OnBeginImplFrameDeadline();
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
+ EXPECT_ACTION_UPDATE_STATE(
+ SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+}
+
TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) {
SchedulerSettings settings;
settings.impl_side_painting = true;