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

Unified Diff: cc/layer_animation_controller.h

Issue 11443004: Maintain global lists of 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_animation_controller.h
diff --git a/cc/layer_animation_controller.h b/cc/layer_animation_controller.h
index be55afe38105cf46cf142caa893665f5254e3567..e21c2f0bcf296637f12251f0e8146d996d30ca77 100644
--- a/cc/layer_animation_controller.h
+++ b/cc/layer_animation_controller.h
@@ -7,10 +7,14 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
#include "cc/animation_events.h"
+#include "cc/animation_registrar.h"
#include "cc/cc_export.h"
#include "cc/scoped_ptr_vector.h"
+#include "ui/gfx/transform.h"
namespace gfx {
class Transform;
@@ -21,22 +25,10 @@ namespace cc {
class Animation;
class KeyframeValueList;
-class CC_EXPORT LayerAnimationControllerClient {
+class CC_EXPORT LayerAnimationController
+ : public base::RefCounted<LayerAnimationController> {
public:
- virtual ~LayerAnimationControllerClient() { }
-
- virtual int id() const = 0;
- virtual void setOpacityFromAnimation(float) = 0;
- virtual float opacity() const = 0;
- virtual void setTransformFromAnimation(const gfx::Transform&) = 0;
- virtual const gfx::Transform& transform() const = 0;
-};
-
-class CC_EXPORT LayerAnimationController {
-public:
- static scoped_ptr<LayerAnimationController> create(LayerAnimationControllerClient*);
-
- virtual ~LayerAnimationController();
+ static scoped_refptr<LayerAnimationController> create(AnimationRegistrar::ThreadName);
// These methods are virtual for testing.
virtual void addAnimation(scoped_ptr<ActiveAnimation>);
@@ -75,10 +67,29 @@ public:
// thread, all animations will be transferred.
void setForceSync() { m_forceSync = true; }
- void setClient(LayerAnimationControllerClient*);
+ void setId(int id);
+
+ // Gets the last animated opacity value.
+ float opacity() const { return m_opacity; }
+
+ // Sets the opacity. Returns true if this call actually updates the opacity.
+ // This can return false if either the new opacity matches the old, or if
+ // the property is currently animating.
+ bool setOpacity(float opacity);
+
+ // Gets the last animate transform value.
+ const gfx::Transform& transform() const { return m_transform; }
+
+ // Sets the transform. Returns true if this call actually updates the
+ // transform. This can return false if either the new transform matches the
+ // old or if the property is currently animating.
+ bool setTransform(const gfx::Transform& transform);
protected:
- explicit LayerAnimationController(LayerAnimationControllerClient*);
+ friend class base::RefCounted<LayerAnimationController>;
+
+ LayerAnimationController(AnimationRegistrar::ThreadName);
+ virtual ~LayerAnimationController();
private:
typedef base::hash_set<int> TargetProperties;
@@ -97,10 +108,16 @@ private:
void tickAnimations(double monotonicTime);
+ void updateActivation();
+
// If this is true, we force a sync to the impl thread.
bool m_forceSync;
- LayerAnimationControllerClient* m_client;
+ float m_opacity;
+ gfx::Transform m_transform;
+
+ AnimationRegistrar::ThreadName m_threadName;
+ int m_id;
ScopedPtrVector<ActiveAnimation> m_activeAnimations;
DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
« cc/animation_registrar.h ('K') | « cc/layer.cc ('k') | cc/layer_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698