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

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
« no previous file with comments | « cc/cc.gyp ('k') | cc/layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer.h
diff --git a/cc/layer.h b/cc/layer.h
index 87839b484fe795efadd08757425520bd220856f1..4483c32ba8fa02eb5f367a1f52b530a2f623c489 100644
--- a/cc/layer.h
+++ b/cc/layer.h
@@ -13,7 +13,8 @@
#include "cc/cc_export.h"
#include "cc/draw_properties.h"
#include "cc/layer_animation_controller.h"
-#include "cc/layer_animation_observer.h"
+#include "cc/layer_animation_event_observer.h"
+#include "cc/layer_animation_value_observer.h"
#include "cc/occlusion_tracker.h"
#include "cc/region.h"
#include "cc/render_surface.h"
@@ -46,21 +47,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 LayerAnimationValueObserver {
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; }
@@ -102,6 +96,7 @@ public:
virtual bool needsDisplay() const;
void setOpacity(float);
+ float opacity() const;
bool opacityIsAnimating() const;
void setFilters(const WebKit::WebFilterOperations&);
@@ -131,6 +126,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; }
@@ -269,8 +265,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; }
@@ -279,8 +275,8 @@ public:
virtual void notifyAnimationStarted(const AnimationEvent&, double wallClockTime);
virtual void notifyAnimationFinished(double wallClockTime);
- void addLayerAnimationObserver(LayerAnimationObserver* animationObserver);
- void removeLayerAnimationObserver(LayerAnimationObserver* animationObserver);
+ void addLayerAnimationEventObserver(LayerAnimationEventObserver* animationObserver);
+ void removeLayerAnimationEventObserver(LayerAnimationEventObserver* animationObserver);
virtual Region visibleContentOpaqueRegion() const;
@@ -336,6 +332,10 @@ private:
// This should only be called from removeFromParent.
void removeChild(Layer*);
+ // LayerAnimationValueObserver implementation.
+ virtual void OnOpacityAnimated(float) OVERRIDE;
+ virtual void OnTransformAnimated(const gfx::Transform&) OVERRIDE;
+
LayerList m_children;
Layer* m_parent;
@@ -344,8 +344,9 @@ private:
// updated via setLayerTreeHost() if a layer moves between trees.
LayerTreeHost* m_layerTreeHost;
- scoped_ptr<LayerAnimationController> m_layerAnimationController;
- ObserverList<LayerAnimationObserver> m_layerAnimationObservers;
+ ObserverList<LayerAnimationEventObserver> m_layerAnimationObservers;
+
+ scoped_refptr<LayerAnimationController> m_layerAnimationController;
// Layer properties.
gfx::Size m_bounds;
« no previous file with comments | « cc/cc.gyp ('k') | cc/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698