| 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(AnimationTargetProperty::Enum 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(AnimationTargetProperty::Enum 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( |
| 87 ObserverType observer_type) const; | 87 AnimationTargetProperty::Enum target_property, |
| 88 ObserverType observer_type) const; |
| 88 | 89 |
| 89 // Returns true if there is an animation that is currently animating the given | 90 // Returns true if there is an animation that is currently animating the given |
| 90 // property and that affects the given observer type. | 91 // property and that affects the given observer type. |
| 91 bool IsCurrentlyAnimatingProperty(Animation::TargetProperty target_property, | 92 bool IsCurrentlyAnimatingProperty( |
| 92 ObserverType observer_type) const; | 93 AnimationTargetProperty::Enum target_property, |
| 94 ObserverType observer_type) const; |
| 93 | 95 |
| 94 void SetAnimationRegistrar(AnimationRegistrar* registrar); | 96 void SetAnimationRegistrar(AnimationRegistrar* registrar); |
| 95 AnimationRegistrar* animation_registrar() { return registrar_; } | 97 AnimationRegistrar* animation_registrar() { return registrar_; } |
| 96 | 98 |
| 97 void NotifyAnimationStarted(const AnimationEvent& event); | 99 void NotifyAnimationStarted(const AnimationEvent& event); |
| 98 void NotifyAnimationFinished(const AnimationEvent& event); | 100 void NotifyAnimationFinished(const AnimationEvent& event); |
| 99 void NotifyAnimationAborted(const AnimationEvent& event); | 101 void NotifyAnimationAborted(const AnimationEvent& event); |
| 100 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); | 102 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); |
| 101 | 103 |
| 102 void AddValueObserver(LayerAnimationValueObserver* observer); | 104 void AddValueObserver(LayerAnimationValueObserver* observer); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 249 |
| 248 bool potentially_animating_transform_for_active_observers_; | 250 bool potentially_animating_transform_for_active_observers_; |
| 249 bool potentially_animating_transform_for_pending_observers_; | 251 bool potentially_animating_transform_for_pending_observers_; |
| 250 | 252 |
| 251 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 253 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
| 252 }; | 254 }; |
| 253 | 255 |
| 254 } // namespace cc | 256 } // namespace cc |
| 255 | 257 |
| 256 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 258 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |