| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bool HasActiveAnimation() const; | 72 bool HasActiveAnimation() const; |
| 73 | 73 |
| 74 // Returns true if there are any animations at all to process. | 74 // Returns true if there are any animations at all to process. |
| 75 bool has_any_animation() const { return !active_animations_.empty(); } | 75 bool has_any_animation() const { return !active_animations_.empty(); } |
| 76 | 76 |
| 77 // Returns true if there is an animation currently animating the given | 77 // Returns true if there is an animation currently animating the given |
| 78 // property, or if there is an animation scheduled to animate this property in | 78 // property, or if there is an animation scheduled to animate this property in |
| 79 // the future. | 79 // the future. |
| 80 bool IsAnimatingProperty(Animation::TargetProperty target_property) const; | 80 bool IsAnimatingProperty(Animation::TargetProperty target_property) const; |
| 81 | 81 |
| 82 // If a sync is forced, then the next time animation updates are pushed to the | |
| 83 // impl thread, all animations will be transferred. | |
| 84 void set_force_sync() { force_sync_ = true; } | |
| 85 | |
| 86 void SetAnimationRegistrar(AnimationRegistrar* registrar); | 82 void SetAnimationRegistrar(AnimationRegistrar* registrar); |
| 87 AnimationRegistrar* animation_registrar() { return registrar_; } | 83 AnimationRegistrar* animation_registrar() { return registrar_; } |
| 88 | 84 |
| 89 void NotifyAnimationStarted(const AnimationEvent& event, | 85 void NotifyAnimationStarted(const AnimationEvent& event, |
| 90 double wall_clock_time); | 86 double wall_clock_time); |
| 91 void NotifyAnimationFinished(const AnimationEvent& event, | 87 void NotifyAnimationFinished(const AnimationEvent& event, |
| 92 double wall_clock_time); | 88 double wall_clock_time); |
| 93 void NotifyAnimationAborted(const AnimationEvent& event); | 89 void NotifyAnimationAborted(const AnimationEvent& event); |
| 94 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); | 90 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); |
| 95 | 91 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 113 | 109 |
| 114 private: | 110 private: |
| 115 typedef base::hash_set<int> TargetProperties; | 111 typedef base::hash_set<int> TargetProperties; |
| 116 | 112 |
| 117 void PushNewAnimationsToImplThread( | 113 void PushNewAnimationsToImplThread( |
| 118 LayerAnimationController* controller_impl) const; | 114 LayerAnimationController* controller_impl) const; |
| 119 void RemoveAnimationsCompletedOnMainThread( | 115 void RemoveAnimationsCompletedOnMainThread( |
| 120 LayerAnimationController* controller_impl) const; | 116 LayerAnimationController* controller_impl) const; |
| 121 void PushPropertiesToImplThread( | 117 void PushPropertiesToImplThread( |
| 122 LayerAnimationController* controller_impl) const; | 118 LayerAnimationController* controller_impl) const; |
| 123 void ReplaceImplThreadAnimations( | |
| 124 LayerAnimationController* controller_impl) const; | |
| 125 | 119 |
| 126 void StartAnimationsWaitingForNextTick(double monotonic_time); | 120 void StartAnimationsWaitingForNextTick(double monotonic_time); |
| 127 void StartAnimationsWaitingForStartTime(double monotonic_time); | 121 void StartAnimationsWaitingForStartTime(double monotonic_time); |
| 128 void StartAnimationsWaitingForTargetAvailability(double monotonic_time); | 122 void StartAnimationsWaitingForTargetAvailability(double monotonic_time); |
| 129 void ResolveConflicts(double monotonic_time); | 123 void ResolveConflicts(double monotonic_time); |
| 130 void PromoteStartedAnimations(double monotonic_time, | 124 void PromoteStartedAnimations(double monotonic_time, |
| 131 AnimationEventsVector* events); | 125 AnimationEventsVector* events); |
| 132 void MarkFinishedAnimations(double monotonic_time); | 126 void MarkFinishedAnimations(double monotonic_time); |
| 133 void MarkAnimationsForDeletion(double monotonic_time, | 127 void MarkAnimationsForDeletion(double monotonic_time, |
| 134 AnimationEventsVector* events); | 128 AnimationEventsVector* events); |
| 135 void PurgeAnimationsMarkedForDeletion(); | 129 void PurgeAnimationsMarkedForDeletion(); |
| 136 | 130 |
| 137 void TickAnimations(double monotonic_time); | 131 void TickAnimations(double monotonic_time); |
| 138 | 132 |
| 139 enum UpdateActivationType { | 133 enum UpdateActivationType { |
| 140 NormalActivation, | 134 NormalActivation, |
| 141 ForceActivation | 135 ForceActivation |
| 142 }; | 136 }; |
| 143 void UpdateActivation(UpdateActivationType type); | 137 void UpdateActivation(UpdateActivationType type); |
| 144 | 138 |
| 145 void NotifyObserversOpacityAnimated(float opacity); | 139 void NotifyObserversOpacityAnimated(float opacity); |
| 146 void NotifyObserversTransformAnimated(const gfx::Transform& transform); | 140 void NotifyObserversTransformAnimated(const gfx::Transform& transform); |
| 147 void NotifyObserversFilterAnimated(const FilterOperations& filter); | 141 void NotifyObserversFilterAnimated(const FilterOperations& filter); |
| 148 | 142 |
| 143 void NotifyObserversAnimationWaitingForDeletion(); |
| 144 |
| 149 bool HasValueObserver(); | 145 bool HasValueObserver(); |
| 150 bool HasActiveValueObserver(); | 146 bool HasActiveValueObserver(); |
| 151 | 147 |
| 152 // If this is true, we force a sync to the impl thread. | |
| 153 bool force_sync_; | |
| 154 | |
| 155 AnimationRegistrar* registrar_; | 148 AnimationRegistrar* registrar_; |
| 156 int id_; | 149 int id_; |
| 157 ScopedPtrVector<Animation> active_animations_; | 150 ScopedPtrVector<Animation> active_animations_; |
| 158 | 151 |
| 159 // This is used to ensure that we don't spam the registrar. | 152 // This is used to ensure that we don't spam the registrar. |
| 160 bool is_active_; | 153 bool is_active_; |
| 161 | 154 |
| 162 double last_tick_time_; | 155 double last_tick_time_; |
| 163 | 156 |
| 164 ObserverList<LayerAnimationValueObserver> value_observers_; | 157 ObserverList<LayerAnimationValueObserver> value_observers_; |
| 165 ObserverList<LayerAnimationEventObserver> event_observers_; | 158 ObserverList<LayerAnimationEventObserver> event_observers_; |
| 166 | 159 |
| 167 AnimationDelegate* layer_animation_delegate_; | 160 AnimationDelegate* layer_animation_delegate_; |
| 168 | 161 |
| 169 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 162 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
| 170 }; | 163 }; |
| 171 | 164 |
| 172 } // namespace cc | 165 } // namespace cc |
| 173 | 166 |
| 174 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 167 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |