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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 713783002: Revert of Moving background animation ticking from LayerTreeHostImpl into the Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler-timesource-refactor
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/scheduler/scheduler_settings.cc ('k') | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_state_machine.cc
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 94016f3d5eb297c62ec496543749905254c4eba9..2b8210d2d2f85de8dbb86a381abff5f6f8266be0 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -423,6 +423,9 @@
}
bool SchedulerStateMachine::ShouldAnimate() const {
+ if (!can_draw_)
+ return false;
+
// If a commit occurred after our last call, we need to do animation again.
if (HasAnimatedThisFrame() && !did_commit_after_animating_)
return false;
@@ -762,10 +765,18 @@
if (!HasInitializedOutputSurface())
return false;
+ // If we can't draw, don't tick until we are notified that we can draw again.
+ if (!can_draw_)
+ return false;
+
// The forced draw respects our normal draw scheduling, so we need to
// request a BeginImplFrame for it.
if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)
return true;
+
+ // There's no need to produce frames if we are not visible.
+ if (!visible_)
+ return false;
// We need to draw a more complete frame than we did the last BeginImplFrame,
// so request another BeginImplFrame in anticipation that we will have
@@ -773,7 +784,10 @@
if (swap_used_incomplete_tile_)
return true;
- return needs_animate_ || needs_redraw_;
+ if (needs_animate_)
+ return true;
+
+ return needs_redraw_;
}
// These are cases where we are very likely to draw soon, but might not
« no previous file with comments | « cc/scheduler/scheduler_settings.cc ('k') | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698