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

Side by Side Diff: cc/layer_animation_controller.h

Issue 11491003: Revert 171714 - Use an auxiliary list of animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_animation_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYER_ANIMATION_CONTROLLER_H_ 5 #ifndef CC_LAYER_ANIMATION_CONTROLLER_H_
6 #define CC_LAYER_ANIMATION_CONTROLLER_H_ 6 #define CC_LAYER_ANIMATION_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
12 #include "base/time.h"
13 #include "cc/animation_events.h" 11 #include "cc/animation_events.h"
14 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
15 #include "cc/scoped_ptr_vector.h" 13 #include "cc/scoped_ptr_vector.h"
16 #include "ui/gfx/transform.h"
17 14
18 namespace gfx { 15 namespace gfx {
19 class Transform; 16 class Transform;
20 } 17 }
21 18
22 namespace cc { 19 namespace cc {
23 20
24 class Animation; 21 class Animation;
25 class AnimationRegistrar;
26 class KeyframeValueList; 22 class KeyframeValueList;
27 23
28 class CC_EXPORT LayerAnimationController 24 class CC_EXPORT LayerAnimationControllerClient {
29 : public base::RefCounted<LayerAnimationController> {
30 public: 25 public:
31 static scoped_refptr<LayerAnimationController> create(); 26 virtual ~LayerAnimationControllerClient() { }
27
28 virtual int id() const = 0;
29 virtual void setOpacityFromAnimation(float) = 0;
30 virtual float opacity() const = 0;
31 virtual void setTransformFromAnimation(const gfx::Transform&) = 0;
32 virtual const gfx::Transform& transform() const = 0;
33 };
34
35 class CC_EXPORT LayerAnimationController {
36 public:
37 static scoped_ptr<LayerAnimationController> create(LayerAnimationControllerC lient*);
38
39 virtual ~LayerAnimationController();
32 40
33 // These methods are virtual for testing. 41 // These methods are virtual for testing.
34 virtual void addAnimation(scoped_ptr<ActiveAnimation>); 42 virtual void addAnimation(scoped_ptr<ActiveAnimation>);
35 virtual void pauseAnimation(int animationId, double timeOffset); 43 virtual void pauseAnimation(int animationId, double timeOffset);
36 virtual void removeAnimation(int animationId); 44 virtual void removeAnimation(int animationId);
37 virtual void removeAnimation(int animationId, ActiveAnimation::TargetPropert y); 45 virtual void removeAnimation(int animationId, ActiveAnimation::TargetPropert y);
38 virtual void suspendAnimations(double monotonicTime); 46 virtual void suspendAnimations(double monotonicTime);
39 virtual void resumeAnimations(double monotonicTime); 47 virtual void resumeAnimations(double monotonicTime);
40 48
41 // Ensures that the list of active animations on the main thread and the imp l thread 49 // Ensures that the list of active animations on the main thread and the imp l thread
(...skipping 18 matching lines...) Expand all
60 bool isAnimatingProperty(ActiveAnimation::TargetProperty) const; 68 bool isAnimatingProperty(ActiveAnimation::TargetProperty) const;
61 69
62 // This is called in response to an animation being started on the impl thre ad. This 70 // This is called in response to an animation being started on the impl thre ad. This
63 // function updates the corresponding main thread animation's start time. 71 // function updates the corresponding main thread animation's start time.
64 void notifyAnimationStarted(const AnimationEvent&); 72 void notifyAnimationStarted(const AnimationEvent&);
65 73
66 // If a sync is forced, then the next time animation updates are pushed to t he impl 74 // If a sync is forced, then the next time animation updates are pushed to t he impl
67 // thread, all animations will be transferred. 75 // thread, all animations will be transferred.
68 void setForceSync() { m_forceSync = true; } 76 void setForceSync() { m_forceSync = true; }
69 77
70 void setAnimationRegistrar(AnimationRegistrar*); 78 void setClient(LayerAnimationControllerClient*);
71 void setId(int id);
72
73 // Gets the last animated opacity value.
74 float opacity() const { return m_opacity; }
75
76 // Sets the opacity. Returns true if this call actually updates the opacity.
77 // This can return false if either the new opacity matches the old, or if
78 // the property is currently animating.
79 bool setOpacity(float opacity);
80
81 // Gets the last animate transform value.
82 const gfx::Transform& transform() const { return m_transform; }
83
84 // Sets the transform. Returns true if this call actually updates the
85 // transform. This can return false if either the new transform matches the
86 // old or if the property is currently animating.
87 bool setTransform(const gfx::Transform& transform);
88 79
89 protected: 80 protected:
90 friend class base::RefCounted<LayerAnimationController>; 81 explicit LayerAnimationController(LayerAnimationControllerClient*);
91
92 LayerAnimationController();
93 virtual ~LayerAnimationController();
94 82
95 private: 83 private:
96 typedef base::hash_set<int> TargetProperties; 84 typedef base::hash_set<int> TargetProperties;
97 85
98 void pushNewAnimationsToImplThread(LayerAnimationController*) const; 86 void pushNewAnimationsToImplThread(LayerAnimationController*) const;
99 void removeAnimationsCompletedOnMainThread(LayerAnimationController*) const; 87 void removeAnimationsCompletedOnMainThread(LayerAnimationController*) const;
100 void pushPropertiesToImplThread(LayerAnimationController*) const; 88 void pushPropertiesToImplThread(LayerAnimationController*) const;
101 void replaceImplThreadAnimations(LayerAnimationController*) const; 89 void replaceImplThreadAnimations(LayerAnimationController*) const;
102 90
103 void startAnimationsWaitingForNextTick(double monotonicTime, AnimationEvents Vector*); 91 void startAnimationsWaitingForNextTick(double monotonicTime, AnimationEvents Vector*);
104 void startAnimationsWaitingForStartTime(double monotonicTime, AnimationEvent sVector*); 92 void startAnimationsWaitingForStartTime(double monotonicTime, AnimationEvent sVector*);
105 void startAnimationsWaitingForTargetAvailability(double monotonicTime, Anima tionEventsVector*); 93 void startAnimationsWaitingForTargetAvailability(double monotonicTime, Anima tionEventsVector*);
106 void resolveConflicts(double monotonicTime); 94 void resolveConflicts(double monotonicTime);
107 void markAnimationsForDeletion(double monotonicTime, AnimationEventsVector*) ; 95 void markAnimationsForDeletion(double monotonicTime, AnimationEventsVector*) ;
108 void purgeAnimationsMarkedForDeletion(); 96 void purgeAnimationsMarkedForDeletion();
109 97
110 void tickAnimations(double monotonicTime); 98 void tickAnimations(double monotonicTime);
111 99
112 void updateRegistration();
113
114 // If this is true, we force a sync to the impl thread. 100 // If this is true, we force a sync to the impl thread.
115 bool m_forceSync; 101 bool m_forceSync;
116 102
117 float m_opacity; 103 LayerAnimationControllerClient* m_client;
118 gfx::Transform m_transform;
119
120 AnimationRegistrar* m_registrar;
121 int m_id;
122 ScopedPtrVector<ActiveAnimation> m_activeAnimations; 104 ScopedPtrVector<ActiveAnimation> m_activeAnimations;
123 105
124 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); 106 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
125 }; 107 };
126 108
127 } // namespace cc 109 } // namespace cc
128 110
129 #endif // CC_LAYER_ANIMATION_CONTROLLER_H_ 111 #endif // CC_LAYER_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/layer.cc ('k') | cc/layer_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698