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

Unified Diff: cc/layer.h

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.h
diff --git a/cc/layer.h b/cc/layer.h
index ede61205538f49bc29e046a2c7a9e14ccd8f34e0..c44797df98581d713abe2aae0bad455aeaa690cc 100644
--- a/cc/layer.h
+++ b/cc/layer.h
@@ -44,21 +44,14 @@ struct RenderingStats;
// Base class for composited layers. Special layer types are derived from
// this class.
-class CC_EXPORT Layer : public base::RefCounted<Layer>, public LayerAnimationControllerClient {
+class CC_EXPORT Layer : public base::RefCounted<Layer>,
+ public LayerAnimationControllerObserver {
public:
typedef std::vector<scoped_refptr<Layer> > LayerList;
static scoped_refptr<Layer> create();
- // LayerAnimationControllerClient implementation
- virtual int id() const OVERRIDE;
- virtual void setOpacityFromAnimation(float) OVERRIDE;
- virtual float opacity() const OVERRIDE;
- virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE;
- // A layer's transform operates layer space. That is, entirely in logical,
- // non-page-scaled pixels (that is, they have page zoom baked in, but not page scale).
- // The root layer is a special case -- it operates in physical pixels.
- virtual const gfx::Transform& transform() const OVERRIDE;
+ int id() const;
Layer* rootLayer();
Layer* parent() { return m_parent; }
@@ -100,6 +93,7 @@ public:
virtual bool needsDisplay() const;
void setOpacity(float);
+ float opacity() const;
bool opacityIsAnimating() const;
void setFilters(const WebKit::WebFilterOperations&);
@@ -129,6 +123,7 @@ public:
const gfx::Transform& sublayerTransform() const { return m_sublayerTransform; }
void setTransform(const gfx::Transform&);
+ const gfx::Transform& transform() const;
bool transformIsAnimating() const;
DrawProperties<Layer, RenderSurface>& drawProperties() { return m_drawProperties; }
@@ -267,8 +262,8 @@ public:
void resumeAnimations(double monotonicTime);
LayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
- void setLayerAnimationController(scoped_ptr<LayerAnimationController>);
- scoped_ptr<LayerAnimationController> releaseLayerAnimationController();
+ void setLayerAnimationController(scoped_refptr<LayerAnimationController>);
+ scoped_refptr<LayerAnimationController> releaseLayerAnimationController();
void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; }
@@ -331,6 +326,10 @@ private:
// This should only be called from removeFromParent.
void removeChild(Layer*);
+ // LayerAnimationControllerObserver implementation.
+ virtual void OnOpacityAnimated(float) OVERRIDE;
+ virtual void OnTransformAnimated(const gfx::Transform&) OVERRIDE;
+
LayerList m_children;
Layer* m_parent;
@@ -339,7 +338,7 @@ private:
// updated via setLayerTreeHost() if a layer moves between trees.
LayerTreeHost* m_layerTreeHost;
- scoped_ptr<LayerAnimationController> m_layerAnimationController;
+ scoped_refptr<LayerAnimationController> m_layerAnimationController;
// Layer properties.
gfx::Size m_bounds;

Powered by Google App Engine
This is Rietveld 408576698