| 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 <bitset> | 8 #include <bitset> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class BoxF; | 24 class BoxF; |
| 25 class Transform; | 25 class Transform; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 | 29 |
| 30 class AnimationDelegate; | 30 class AnimationDelegate; |
| 31 class AnimationEvents; | 31 class AnimationEvents; |
| 32 class AnimationRegistrar; | 32 class AnimationHost; |
| 33 class FilterOperations; | 33 class FilterOperations; |
| 34 class KeyframeValueList; | 34 class KeyframeValueList; |
| 35 class LayerAnimationValueObserver; | 35 class LayerAnimationValueObserver; |
| 36 class LayerAnimationValueProvider; | 36 class LayerAnimationValueProvider; |
| 37 | 37 |
| 38 class CC_EXPORT LayerAnimationController | 38 class CC_EXPORT LayerAnimationController |
| 39 : public base::RefCounted<LayerAnimationController> { | 39 : public base::RefCounted<LayerAnimationController> { |
| 40 public: | 40 public: |
| 41 enum class ObserverType { ACTIVE, PENDING }; | 41 enum class ObserverType { ACTIVE, PENDING }; |
| 42 | 42 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // the given property or scheduled to animate this property in the future, and | 85 // the given property or scheduled to animate this property in the future, and |
| 86 // that affects the given observer type. | 86 // that affects the given observer type. |
| 87 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property, | 87 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property, |
| 88 ObserverType observer_type) const; | 88 ObserverType observer_type) const; |
| 89 | 89 |
| 90 // 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 |
| 91 // property and that affects the given observer type. | 91 // property and that affects the given observer type. |
| 92 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, | 92 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, |
| 93 ObserverType observer_type) const; | 93 ObserverType observer_type) const; |
| 94 | 94 |
| 95 void SetAnimationRegistrar(AnimationRegistrar* registrar); | 95 void SetAnimationHost(AnimationHost* host); |
| 96 AnimationRegistrar* animation_registrar() { return registrar_; } | 96 AnimationHost* animation_host() { return host_; } |
| 97 | 97 |
| 98 void NotifyAnimationStarted(const AnimationEvent& event); | 98 void NotifyAnimationStarted(const AnimationEvent& event); |
| 99 void NotifyAnimationFinished(const AnimationEvent& event); | 99 void NotifyAnimationFinished(const AnimationEvent& event); |
| 100 void NotifyAnimationAborted(const AnimationEvent& event); | 100 void NotifyAnimationAborted(const AnimationEvent& event); |
| 101 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); | 101 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); |
| 102 void NotifyAnimationTakeover(const AnimationEvent& event); | 102 void NotifyAnimationTakeover(const AnimationEvent& event); |
| 103 | 103 |
| 104 void AddValueObserver(LayerAnimationValueObserver* observer); | 104 void AddValueObserver(LayerAnimationValueObserver* observer); |
| 105 void RemoveValueObserver(LayerAnimationValueObserver* observer); | 105 void RemoveValueObserver(LayerAnimationValueObserver* observer); |
| 106 | 106 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 219 |
| 220 void NotifyObserversTransformIsPotentiallyAnimatingChanged( | 220 void NotifyObserversTransformIsPotentiallyAnimatingChanged( |
| 221 bool notify_active_observers, | 221 bool notify_active_observers, |
| 222 bool notify_pending_observers); | 222 bool notify_pending_observers); |
| 223 | 223 |
| 224 void UpdatePotentiallyAnimatingTransform(); | 224 void UpdatePotentiallyAnimatingTransform(); |
| 225 | 225 |
| 226 bool HasValueObserver(); | 226 bool HasValueObserver(); |
| 227 bool HasActiveValueObserver(); | 227 bool HasActiveValueObserver(); |
| 228 | 228 |
| 229 AnimationRegistrar* registrar_; | 229 AnimationHost* host_; |
| 230 int id_; | 230 int id_; |
| 231 std::vector<std::unique_ptr<Animation>> animations_; | 231 std::vector<std::unique_ptr<Animation>> animations_; |
| 232 | 232 |
| 233 // This is used to ensure that we don't spam the registrar. | 233 // This is used to ensure that we don't spam the animation host. |
| 234 bool is_active_; | 234 bool is_active_; |
| 235 | 235 |
| 236 base::TimeTicks last_tick_time_; | 236 base::TimeTicks last_tick_time_; |
| 237 | 237 |
| 238 base::ObserverList<LayerAnimationValueObserver> value_observers_; | 238 base::ObserverList<LayerAnimationValueObserver> value_observers_; |
| 239 base::ObserverList<LayerAnimationEventObserver> event_observers_; | 239 base::ObserverList<LayerAnimationEventObserver> event_observers_; |
| 240 | 240 |
| 241 LayerAnimationValueProvider* value_provider_; | 241 LayerAnimationValueProvider* value_provider_; |
| 242 | 242 |
| 243 AnimationDelegate* layer_animation_delegate_; | 243 AnimationDelegate* layer_animation_delegate_; |
| 244 | 244 |
| 245 // Only try to start animations when new animations are added or when the | 245 // Only try to start animations when new animations are added or when the |
| 246 // previous attempt at starting animations failed to start all animations. | 246 // previous attempt at starting animations failed to start all animations. |
| 247 bool needs_to_start_animations_; | 247 bool needs_to_start_animations_; |
| 248 | 248 |
| 249 bool scroll_offset_animation_was_interrupted_; | 249 bool scroll_offset_animation_was_interrupted_; |
| 250 | 250 |
| 251 bool potentially_animating_transform_for_active_observers_; | 251 bool potentially_animating_transform_for_active_observers_; |
| 252 bool potentially_animating_transform_for_pending_observers_; | 252 bool potentially_animating_transform_for_pending_observers_; |
| 253 | 253 |
| 254 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 254 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 } // namespace cc | 257 } // namespace cc |
| 258 | 258 |
| 259 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 259 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |