diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-08 17:01:18 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-08 17:01:18 +0000 |
commit | df1ec1ac79676fbc12181317c6febd199ad09728 (patch) | |
tree | a04f90c142fc1e9d4e82e7e345250bb8daa06385 /cc/test | |
parent | 9b39fe5ba8173f8e4a505149440069a546f6107a (diff) | |
download | chromium_src-df1ec1ac79676fbc12181317c6febd199ad09728.zip chromium_src-df1ec1ac79676fbc12181317c6febd199ad09728.tar.gz chromium_src-df1ec1ac79676fbc12181317c6febd199ad09728.tar.bz2 |
Revert 171714 - Use an auxiliary list of animation controllers.
> With this patch we accomplish the following:
> 1. layer animation controllers are ref counted (so they can be shared by the two impl trees)
> 2. the layer tree hosts now own a list of active animation controllers. This allows for a couple of nice things
> __a. Ticking the animation controllers no longer requires a tree walk
> __b. We will be able to support ticking of animation controllers for layers that are not yet added to the layer tree. (Support coming in a future patch).
> 3. animation controllers register and unregister themselves from their respective layer tree host's list when they have an animation to tick.
>
> BUG=162111
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=171714
TBR=vollick@chromium.org
BUG=
Review URL: https://codereview.chromium.org/11491003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/animation_test_common.cc | 34 | ||||
-rw-r--r-- | cc/test/animation_test_common.h | 17 | ||||
-rw-r--r-- | cc/test/fake_proxy.h | 1 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.cc | 28 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.h | 1 |
5 files changed, 75 insertions, 6 deletions
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc index 678f8de..b6ba614 100644 --- a/cc/test/animation_test_common.cc +++ b/cc/test/animation_test_common.cc @@ -150,6 +150,40 @@ float FakeFloatTransition::getValue(double time) const return (1 - time) * m_from + time * m_to; } +FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient() + : m_opacity(0) +{ +} + +FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient() +{ +} + +int FakeLayerAnimationControllerClient::id() const +{ + return 0; +} + +void FakeLayerAnimationControllerClient::setOpacityFromAnimation(float opacity) +{ + m_opacity = opacity; +} + +float FakeLayerAnimationControllerClient::opacity() const +{ + return m_opacity; +} + +void FakeLayerAnimationControllerClient::setTransformFromAnimation(const gfx::Transform& transform) +{ + m_transform = transform; +} + +const gfx::Transform& FakeLayerAnimationControllerClient::transform() const +{ + return m_transform; +} + scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const { return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationCurve>(); diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h index a45e9f0..6ee0cdd 100644 --- a/cc/test/animation_test_common.h +++ b/cc/test/animation_test_common.h @@ -60,6 +60,23 @@ private: float m_to; }; +class FakeLayerAnimationControllerClient : public cc::LayerAnimationControllerClient { +public: + FakeLayerAnimationControllerClient(); + virtual ~FakeLayerAnimationControllerClient(); + + // LayerAnimationControllerClient implementation + virtual int id() const OVERRIDE; + virtual void setOpacityFromAnimation(float) OVERRIDE; + virtual float opacity() const OVERRIDE; + virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; + virtual const gfx::Transform& transform() const OVERRIDE; + +private: + float m_opacity; + gfx::Transform m_transform; +}; + int addOpacityTransitionToController(cc::LayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction); int addAnimatedTransformToController(cc::LayerAnimationController&, double duration, int deltaX, int deltaY); diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index a87310e..c89f120 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -30,6 +30,7 @@ public: virtual void setNeedsCommit() OVERRIDE { } virtual void setNeedsRedraw() OVERRIDE { } virtual void setDeferCommits(bool) OVERRIDE { } + virtual void didAddAnimation() OVERRIDE { } virtual bool commitRequested() const OVERRIDE; virtual void start() OVERRIDE { } virtual void stop() OVERRIDE { } diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc index dd40f13..bfa15dd 100644 --- a/cc/test/layer_tree_test_common.cc +++ b/cc/test/layer_tree_test_common.cc @@ -156,6 +156,12 @@ public: return MockLayerTreeHostImpl::create(m_testHooks, settings(), client, proxy()).PassAs<cc::LayerTreeHostImpl>(); } + virtual void didAddAnimation() OVERRIDE + { + LayerTreeHost::didAddAnimation(); + m_testHooks->didAddAnimation(); + } + virtual void setNeedsCommit() OVERRIDE { if (!m_testStarted) @@ -163,12 +169,6 @@ public: LayerTreeHost::setNeedsCommit(); } - virtual void DidActivateAnimationController(cc::LayerAnimationController* controller) OVERRIDE - { - LayerTreeHost::DidActivateAnimationController(controller); - m_testHooks->didAddAnimation(); - } - void setTestStarted(bool started) { m_testStarted = started; } virtual void didDeferCommit() OVERRIDE @@ -335,6 +335,11 @@ void ThreadedTest::postSetVisibleToMainThread(bool visible) m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchSetVisible, base::Unretained(this), visible)); } +void ThreadedTest::postDidAddAnimationToMainThread() +{ + m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchDidAddAnimation, base::Unretained(this))); +} + void ThreadedTest::doBeginTest() { m_client = ThreadedMockLayerTreeHostClient::create(this); @@ -464,6 +469,17 @@ void ThreadedTest::dispatchComposite() m_layerTreeHost->composite(); } +void ThreadedTest::dispatchDidAddAnimation() +{ + DCHECK(!proxy() || proxy()->isMainThread()); + + if (m_finished) + return; + + if (m_layerTreeHost.get()) + m_layerTreeHost->didAddAnimation(); +} + void ThreadedTest::runTest(bool threaded) { if (threaded) { diff --git a/cc/test/layer_tree_test_common.h b/cc/test/layer_tree_test_common.h index ebc9c05..f126bb5 100644 --- a/cc/test/layer_tree_test_common.h +++ b/cc/test/layer_tree_test_common.h @@ -84,6 +84,7 @@ public: void postAcquireLayerTextures(); void postSetNeedsRedrawToMainThread(); void postSetVisibleToMainThread(bool visible); + void postDidAddAnimationToMainThread(); void doBeginTest(); void timeout(); |