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

Unified Diff: cc/layer_impl.cc

Issue 11598005: Ref count layer animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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/layer_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index e1cf9d49fd8695871fa11f6bc3ce5511864c715a..7f6bdb4dc55789f4500076c91d7955c803d60d6b 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -50,11 +50,13 @@ LayerImpl::LayerImpl(LayerTreeImpl* treeImpl, int id)
#ifndef NDEBUG
, m_betweenWillDrawAndDidDraw(false)
#endif
- , m_layerAnimationController(LayerAnimationController::create(this))
{
DCHECK(m_layerId > 0);
DCHECK(m_layerTreeImpl);
m_layerTreeImpl->RegisterLayer(this);
+ AnimationRegistrar* registrar = m_layerTreeImpl;
+ m_layerAnimationController = registrar->GetAnimationControllerForId(m_layerId);
+ m_layerAnimationController->addObserver(this);
}
LayerImpl::~LayerImpl()
@@ -63,6 +65,7 @@ LayerImpl::~LayerImpl()
DCHECK(!m_betweenWillDrawAndDidDraw);
#endif
m_layerTreeImpl->UnregisterLayer(this);
+ m_layerAnimationController->removeObserver(this);
}
void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
@@ -459,22 +462,12 @@ int LayerImpl::id() const
return m_layerId;
}
-float LayerImpl::opacity() const
-{
- return m_opacity;
-}
-
-void LayerImpl::setOpacityFromAnimation(float opacity)
+void LayerImpl::OnOpacityAnimated(float opacity)
{
setOpacity(opacity);
}
-const gfx::Transform& LayerImpl::transform() const
-{
- return m_transform;
-}
-
-void LayerImpl::setTransformFromAnimation(const gfx::Transform& transform)
+void LayerImpl::OnTransformAnimated(const gfx::Transform& transform)
{
setTransform(transform);
}
@@ -626,6 +619,11 @@ void LayerImpl::setOpacity(float opacity)
noteLayerSurfacePropertyChanged();
}
+float LayerImpl::opacity() const
+{
+ return m_opacity;
+}
+
bool LayerImpl::opacityIsAnimating() const
{
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity);
@@ -668,6 +666,11 @@ void LayerImpl::setTransform(const gfx::Transform& transform)
noteLayerSurfacePropertyChanged();
}
+const gfx::Transform& LayerImpl::transform() const
+{
+ return m_transform;
+}
+
bool LayerImpl::transformIsAnimating() const
{
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Transform);

Powered by Google App Engine
This is Rietveld 408576698