OLD | NEW |
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_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 5 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
7 | 7 |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 enum class ObserverType { ACTIVE, PENDING }; | 40 enum class ObserverType { ACTIVE, PENDING }; |
41 | 41 |
42 static scoped_refptr<LayerAnimationController> Create(int id); | 42 static scoped_refptr<LayerAnimationController> Create(int id); |
43 | 43 |
44 int id() const { return id_; } | 44 int id() const { return id_; } |
45 | 45 |
46 void AddAnimation(scoped_ptr<Animation> animation); | 46 void AddAnimation(scoped_ptr<Animation> animation); |
47 void PauseAnimation(int animation_id, base::TimeDelta time_offset); | 47 void PauseAnimation(int animation_id, base::TimeDelta time_offset); |
48 void RemoveAnimation(int animation_id); | 48 void RemoveAnimation(int animation_id); |
49 void AbortAnimation(int animation_id); | 49 void AbortAnimation(int animation_id); |
50 void AbortAnimations(Animation::TargetProperty target_property); | 50 void AbortAnimations(TargetProperty::Type target_property); |
51 | 51 |
52 // Ensures that the list of active animations on the main thread and the impl | 52 // Ensures that the list of active animations on the main thread and the impl |
53 // thread are kept in sync. This function does not take ownership of the impl | 53 // thread are kept in sync. This function does not take ownership of the impl |
54 // thread controller. This method is virtual for testing. | 54 // thread controller. This method is virtual for testing. |
55 virtual void PushAnimationUpdatesTo( | 55 virtual void PushAnimationUpdatesTo( |
56 LayerAnimationController* controller_impl); | 56 LayerAnimationController* controller_impl); |
57 | 57 |
58 void Animate(base::TimeTicks monotonic_time); | 58 void Animate(base::TimeTicks monotonic_time); |
59 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time, | 59 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time, |
60 AnimationEvents* events); | 60 AnimationEvents* events); |
61 | 61 |
62 void UpdateState(bool start_ready_animations, AnimationEvents* events); | 62 void UpdateState(bool start_ready_animations, AnimationEvents* events); |
63 | 63 |
64 // Make animations affect active observers if and only if they affect | 64 // Make animations affect active observers if and only if they affect |
65 // pending observers. Any animations that no longer affect any observers | 65 // pending observers. Any animations that no longer affect any observers |
66 // are deleted. | 66 // are deleted. |
67 void ActivateAnimations(); | 67 void ActivateAnimations(); |
68 | 68 |
69 // Returns the active animation animating the given property that is either | 69 // Returns the active animation animating the given property that is either |
70 // running, or is next to run, if such an animation exists. | 70 // running, or is next to run, if such an animation exists. |
71 Animation* GetAnimation(Animation::TargetProperty target_property) const; | 71 Animation* GetAnimation(TargetProperty::Type target_property) const; |
72 | 72 |
73 // Returns the active animation for the given unique animation id. | 73 // Returns the active animation for the given unique animation id. |
74 Animation* GetAnimationById(int animation_id) const; | 74 Animation* GetAnimationById(int animation_id) const; |
75 | 75 |
76 // Returns true if there are any animations that have neither finished nor | 76 // Returns true if there are any animations that have neither finished nor |
77 // aborted. | 77 // aborted. |
78 bool HasActiveAnimation() const; | 78 bool HasActiveAnimation() const; |
79 | 79 |
80 // Returns true if there are any animations at all to process. | 80 // Returns true if there are any animations at all to process. |
81 bool has_any_animation() const { return !animations_.empty(); } | 81 bool has_any_animation() const { return !animations_.empty(); } |
82 | 82 |
83 // Returns true if there is an animation that is either currently animating | 83 // Returns true if there is an animation that is either currently animating |
84 // the given property or scheduled to animate this property in the future, and | 84 // the given property or scheduled to animate this property in the future, and |
85 // that affects the given observer type. | 85 // that affects the given observer type. |
86 bool IsPotentiallyAnimatingProperty(Animation::TargetProperty target_property, | 86 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property, |
87 ObserverType observer_type) const; | 87 ObserverType observer_type) const; |
88 | 88 |
89 // Returns true if there is an animation that is currently animating the given | 89 // Returns true if there is an animation that is currently animating the given |
90 // property and that affects the given observer type. | 90 // property and that affects the given observer type. |
91 bool IsCurrentlyAnimatingProperty(Animation::TargetProperty target_property, | 91 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, |
92 ObserverType observer_type) const; | 92 ObserverType observer_type) const; |
93 | 93 |
94 void SetAnimationRegistrar(AnimationRegistrar* registrar); | 94 void SetAnimationRegistrar(AnimationRegistrar* registrar); |
95 AnimationRegistrar* animation_registrar() { return registrar_; } | 95 AnimationRegistrar* animation_registrar() { return registrar_; } |
96 | 96 |
97 void NotifyAnimationStarted(const AnimationEvent& event); | 97 void NotifyAnimationStarted(const AnimationEvent& event); |
98 void NotifyAnimationFinished(const AnimationEvent& event); | 98 void NotifyAnimationFinished(const AnimationEvent& event); |
99 void NotifyAnimationAborted(const AnimationEvent& event); | 99 void NotifyAnimationAborted(const AnimationEvent& event); |
100 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); | 100 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); |
101 | 101 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 bool potentially_animating_transform_for_active_observers_; | 248 bool potentially_animating_transform_for_active_observers_; |
249 bool potentially_animating_transform_for_pending_observers_; | 249 bool potentially_animating_transform_for_pending_observers_; |
250 | 250 |
251 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 251 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
252 }; | 252 }; |
253 | 253 |
254 } // namespace cc | 254 } // namespace cc |
255 | 255 |
256 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 256 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
OLD | NEW |