summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_impl.h
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:35:18 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:35:18 +0000
commit3d9f74315b09318f7459f6654c2eac21dc46cff8 (patch)
tree01082af9bd757db78a0185e8b0b96090fc7e5bb3 /cc/trees/layer_tree_host_impl.h
parent13ba1daed34f6e54cc159b56dbc6f16afafae303 (diff)
downloadchromium_src-3d9f74315b09318f7459f6654c2eac21dc46cff8.zip
chromium_src-3d9f74315b09318f7459f6654c2eac21dc46cff8.tar.gz
chromium_src-3d9f74315b09318f7459f6654c2eac21dc46cff8.tar.bz2
cc: Make animations tick regardless of drawing.
The compositor should tick and finish animations even if it is not drawing anything. It can not draw for various reasons: 1) The tab is backgrounded. 2) CanDraw() is false for any of its reasons. 3) PrepareToDraw() fails due to checkerboarding. 4) There is no damage on the screen to draw. Currently the problems are: - When backgrounded, the animations are ticked but their states are not updated. - When CanDraw() is false, we don't draw, and animations just stop ticking. - If we stop drawing when we damage the screen, we tick animations, but don't update animation state since this happens in DrawLayers(). To solve these problems, I've moved the animation control more explicitly out of LayerTreeHostImpl. The proxy already calls Animate(). Now it will also call UpdateAnimationState(). It always does this after calling Animate() regardless if drawing or not. Secondly, the missing UpdateAnimationState() call is added to the OnTimerTick for background animation ticking. We enable background ticking only when we change visibility, currently. But when CanDraw() is false, we don't draw and thus don't tick animations. So instead we add to LayerTreeHostImpl a UpdateBackgroundAnimateTicking() method. We call this always after calling Animate() since that can remove animations - it's something Animate() used to do. And we also call this: a) After a commit - this could add new animations, or change visibility. b) After changing CanDraw()'s state. However, when PrepareToDraw() is false, we do not want to start new animations so we let animations finish without starting new ones. This is verified by the LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations test. This is covered by adding single-thread mode to all the animation unit tests (except those that call SetNeedsAnimate() which is not legal in single thread mode). Also by new tests: LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw.RunSingleThread LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw.RunMultiThread LayerTreeHostAnimationTestRunAnimationWhenNotVisible.RunSingleThread LayerTreeHostAnimationTestRunAnimationWhenNotVisible.RunMultiThread LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations.RunMultiThread Added scheduler tests: SchedulerStateMachineTest.ReportIfNotDrawing SchedulerStateMachineTest.ReportIfNotDrawingFromAcquiredTextures R=ajuma@chromium.org BUG=222915 Review URL: https://chromiumcodereview.appspot.com/13613003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192671 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees/layer_tree_host_impl.h')
-rw-r--r--cc/trees/layer_tree_host_impl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index ef0c41e..016b165 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -140,6 +140,8 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
virtual void CommitComplete();
virtual void Animate(base::TimeTicks monotonic_time,
base::Time wall_clock_time);
+ virtual void UpdateAnimationState(bool start_ready_animations);
+ void UpdateBackgroundAnimateTicking(bool should_background_tick);
void ManageTiles();
void SetAnticipatedDrawTime(base::TimeTicks time);
@@ -356,7 +358,6 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
// Virtual for testing.
virtual void AnimateLayers(base::TimeTicks monotonic_time,
base::Time wall_clock_time);
- virtual void UpdateAnimationState();
// Virtual for testing.
virtual base::TimeDelta LowFrequencyAnimationInterval() const;
@@ -389,7 +390,6 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
// only be called from PrepareToDraw, as DidDrawAllLayers must be called
// if this helper function is called.
bool CalculateRenderPasses(FrameData* frame);
- void SetBackgroundTickingEnabled(bool enabled);
void SendDidLoseOutputSurfaceRecursive(LayerImpl* current);
void ClearRenderSurfaces();