| Index: cc/scheduler/scheduler_state_machine.cc
|
| diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
|
| index 2bbf2563264bb1365654663e8d13435346357137..9c1e8f758adb4b080ca7e8dab7aae994216fc837 100644
|
| --- a/cc/scheduler/scheduler_state_machine.cc
|
| +++ b/cc/scheduler/scheduler_state_machine.cc
|
| @@ -23,12 +23,14 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
|
| readback_state_(READBACK_STATE_IDLE),
|
| commit_count_(0),
|
| current_frame_number_(0),
|
| + last_frame_number_animate_performed_(-1),
|
| last_frame_number_swap_performed_(-1),
|
| last_frame_number_begin_main_frame_sent_(-1),
|
| last_frame_number_update_visible_tiles_was_called_(-1),
|
| manage_tiles_funnel_(0),
|
| consecutive_checkerboard_animations_(0),
|
| needs_redraw_(false),
|
| + needs_animate_(false),
|
| needs_manage_tiles_(false),
|
| swap_used_incomplete_tile_(false),
|
| needs_commit_(false),
|
| @@ -154,6 +156,8 @@ const char* SchedulerStateMachine::ActionToString(Action action) {
|
| switch (action) {
|
| case ACTION_NONE:
|
| return "ACTION_NONE";
|
| + case ACTION_ANIMATE:
|
| + return "ACTION_ANIMATE";
|
| case ACTION_SEND_BEGIN_MAIN_FRAME:
|
| return "ACTION_SEND_BEGIN_MAIN_FRAME";
|
| case ACTION_COMMIT:
|
| @@ -235,6 +239,8 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const {
|
| minor_state->SetInteger("commit_count", commit_count_);
|
| minor_state->SetInteger("current_frame_number", current_frame_number_);
|
|
|
| + minor_state->SetInteger("last_frame_number_animate_performed",
|
| + last_frame_number_animate_performed_);
|
| minor_state->SetInteger("last_frame_number_swap_performed",
|
| last_frame_number_swap_performed_);
|
| minor_state->SetInteger(
|
| @@ -248,6 +254,7 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const {
|
| minor_state->SetInteger("consecutive_checkerboard_animations",
|
| consecutive_checkerboard_animations_);
|
| minor_state->SetBoolean("needs_redraw", needs_redraw_);
|
| + minor_state->SetBoolean("needs_animate_", needs_animate_);
|
| minor_state->SetBoolean("needs_manage_tiles", needs_manage_tiles_);
|
| minor_state->SetBoolean("swap_used_incomplete_tile",
|
| swap_used_incomplete_tile_);
|
| @@ -455,6 +462,20 @@ bool SchedulerStateMachine::ShouldUpdateVisibleTiles() const {
|
| return false;
|
| }
|
|
|
| +bool SchedulerStateMachine::ShouldAnimate() const {
|
| + if (!can_draw_)
|
| + return false;
|
| +
|
| + if (last_frame_number_animate_performed_ == current_frame_number_)
|
| + 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 needs_redraw_ || needs_animate_;
|
| +}
|
| +
|
| bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
|
| if (!needs_commit_)
|
| return false;
|
| @@ -556,6 +577,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
|
| return ACTION_ACTIVATE_PENDING_TREE;
|
| if (ShouldCommit())
|
| return ACTION_COMMIT;
|
| + if (ShouldAnimate())
|
| + return ACTION_ANIMATE;
|
| if (ShouldDraw()) {
|
| if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK)
|
| return ACTION_DRAW_AND_READBACK;
|
| @@ -601,6 +624,14 @@ void SchedulerStateMachine::UpdateState(Action action) {
|
| UpdateStateOnActivation();
|
| return;
|
|
|
| + case ACTION_ANIMATE:
|
| + last_frame_number_animate_performed_ = current_frame_number_;
|
| + needs_animate_ = false;
|
| + // TODO(skyostil): Instead of assuming this, require the client to tell
|
| + // us.
|
| + SetNeedsRedraw();
|
| + return;
|
| +
|
| case ACTION_SEND_BEGIN_MAIN_FRAME:
|
| DCHECK(!has_pending_tree_ ||
|
| settings_.main_frame_before_activation_enabled);
|
| @@ -870,6 +901,9 @@ bool SchedulerStateMachine::BeginImplFrameNeededToDraw() const {
|
| if (swap_used_incomplete_tile_)
|
| return true;
|
|
|
| + if (needs_animate_)
|
| + return true;
|
| +
|
| return needs_redraw_;
|
| }
|
|
|
| @@ -1035,6 +1069,8 @@ void SchedulerStateMachine::SetCanDraw(bool can_draw) { can_draw_ = can_draw; }
|
|
|
| void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; }
|
|
|
| +void SchedulerStateMachine::SetNeedsAnimate() { needs_animate_ = true; }
|
| +
|
| void SchedulerStateMachine::SetNeedsManageTiles() {
|
| if (!needs_manage_tiles_) {
|
| TRACE_EVENT0("cc",
|
|
|