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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 206793003: cc: Split animating and drawing into separate actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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
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..25ac240249f006372e6322ec8590e0c2087ccf39 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -23,6 +23,7 @@ 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),
@@ -154,6 +155,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 +238,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(
@@ -455,6 +460,16 @@ bool SchedulerStateMachine::ShouldUpdateVisibleTiles() const {
return false;
}
+bool SchedulerStateMachine::ShouldAnimate() const {
+ if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING)
+ return false;
+
+ if (last_frame_number_animate_performed_ == current_frame_number_)
+ return false;
+
+ return true;
+}
+
bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
if (!needs_commit_)
return false;
@@ -568,6 +583,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
}
if (ShouldManageTiles())
return ACTION_MANAGE_TILES;
+ if (ShouldAnimate())
+ return ACTION_ANIMATE;
if (ShouldSendBeginMainFrame())
return ACTION_SEND_BEGIN_MAIN_FRAME;
if (ShouldBeginOutputSurfaceCreation())
@@ -601,6 +618,10 @@ void SchedulerStateMachine::UpdateState(Action action) {
UpdateStateOnActivation();
return;
+ case ACTION_ANIMATE:
+ last_frame_number_animate_performed_ = current_frame_number_;
+ return;
+
case ACTION_SEND_BEGIN_MAIN_FRAME:
DCHECK(!has_pending_tree_ ||
settings_.main_frame_before_activation_enabled);

Powered by Google App Engine
This is Rietveld 408576698