diff options
author | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-09 18:14:37 +0000 |
---|---|---|
committer | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-09 18:14:37 +0000 |
commit | d7763662fb004c4cb55877e0f5a89d0af5bf6044 (patch) | |
tree | 539a55008eb2849e52e3d85bbb2aead7b424a58e /cc/trees/layer_tree_host_unittest_animation.cc | |
parent | caf895ddb935f0bc6e04f9afca2d0824959e7ae4 (diff) | |
download | chromium_src-d7763662fb004c4cb55877e0f5a89d0af5bf6044.zip chromium_src-d7763662fb004c4cb55877e0f5a89d0af5bf6044.tar.gz chromium_src-d7763662fb004c4cb55877e0f5a89d0af5bf6044.tar.bz2 |
Make SingleThreadProxy update LayerTreeHost's animations
ThreadProxy updates LayerTreeHost's animations every frame, but
SingleThreadProxy relies on Blink to update animations (via
RenderWidget::scheduleAnimation and RenderWidget::AnimateIfNeeded).
So, when using SingleThreadProxy, if Blink thinks there are no
animations running, LayerTreeHost::AnimateLayers never gets called.
But finished animations aren't marked for deletion until the first
call to AnimateLayers after the finished notification is received.
This means that when using SingleThreadProxy, a finished animation
won't get marked for deletion (or get deleted) until some other
animation is running.
This CL makes SingleThreadProxy call LayerTreeHost::AnimateLayers
every frame, making its behavior more similar to ThreadProxy.
BUG=238848
Review URL: https://chromiumcodereview.appspot.com/14907014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees/layer_tree_host_unittest_animation.cc')
-rw-r--r-- | cc/trees/layer_tree_host_unittest_animation.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index a86253b5..aa8843d 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -214,6 +214,45 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws // Starvation can only be an issue with the MT compositor. MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws); +// Ensures that animations eventually get deleted. +class LayerTreeHostAnimationTestAnimationsGetDeleted + : public LayerTreeHostAnimationTest { + public: + LayerTreeHostAnimationTestAnimationsGetDeleted() + : started_animating_(false) {} + + virtual void BeginTest() OVERRIDE { + PostAddAnimationToMainThread(layer_tree_host()->root_layer()); + } + + virtual void AnimateLayers( + LayerTreeHostImpl* host_impl, + base::TimeTicks monotonic_time) OVERRIDE { + bool have_animations = !host_impl->animation_registrar()-> + active_animation_controllers().empty(); + if (!started_animating_ && have_animations) { + started_animating_ = true; + return; + } + + if (started_animating_ && !have_animations) + EndTest(); + } + + virtual void notifyAnimationFinished(double time) OVERRIDE { + // Animations on the impl-side controller only get deleted during a commit, + // so we need to schedule a commit. + layer_tree_host()->SetNeedsCommit(); + } + + virtual void AfterTest() OVERRIDE {} + + private: + bool started_animating_; +}; + +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted); + // Ensures that animations continue to be ticked when we are backgrounded. class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded : public LayerTreeHostAnimationTest { |