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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void RemoveAnimation(int animation_id, | 45 void RemoveAnimation(int animation_id, |
46 Animation::TargetProperty target_property); | 46 Animation::TargetProperty target_property); |
47 void AbortAnimations(Animation::TargetProperty target_property); | 47 void AbortAnimations(Animation::TargetProperty target_property); |
48 | 48 |
49 // Ensures that the list of active animations on the main thread and the impl | 49 // Ensures that the list of active animations on the main thread and the impl |
50 // thread are kept in sync. This function does not take ownership of the impl | 50 // thread are kept in sync. This function does not take ownership of the impl |
51 // thread controller. This method is virtual for testing. | 51 // thread controller. This method is virtual for testing. |
52 virtual void PushAnimationUpdatesTo( | 52 virtual void PushAnimationUpdatesTo( |
53 LayerAnimationController* controller_impl); | 53 LayerAnimationController* controller_impl); |
54 | 54 |
55 void Animate(double monotonic_time); | 55 void Animate(base::TimeTicks monotonic_time); |
56 void AccumulatePropertyUpdates(double monotonic_time, | 56 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time, |
57 AnimationEventsVector* events); | 57 AnimationEventsVector* events); |
58 | 58 |
59 void UpdateState(bool start_ready_animations, | 59 void UpdateState(bool start_ready_animations, |
60 AnimationEventsVector* events); | 60 AnimationEventsVector* events); |
61 | 61 |
62 // Returns the active animation in the given group, animating the given | 62 // Returns the active animation in the given group, animating the given |
63 // property, if such an animation exists. | 63 // property, if such an animation exists. |
64 Animation* GetAnimation(int group_id, | 64 Animation* GetAnimation(int group_id, |
65 Animation::TargetProperty target_property) const; | 65 Animation::TargetProperty target_property) const; |
66 | 66 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 private: | 136 private: |
137 typedef base::hash_set<int> TargetProperties; | 137 typedef base::hash_set<int> TargetProperties; |
138 | 138 |
139 void PushNewAnimationsToImplThread( | 139 void PushNewAnimationsToImplThread( |
140 LayerAnimationController* controller_impl) const; | 140 LayerAnimationController* controller_impl) const; |
141 void RemoveAnimationsCompletedOnMainThread( | 141 void RemoveAnimationsCompletedOnMainThread( |
142 LayerAnimationController* controller_impl) const; | 142 LayerAnimationController* controller_impl) const; |
143 void PushPropertiesToImplThread( | 143 void PushPropertiesToImplThread( |
144 LayerAnimationController* controller_impl) const; | 144 LayerAnimationController* controller_impl) const; |
145 | 145 |
146 void StartAnimations(double monotonic_time); | 146 void StartAnimations(base::TimeTicks monotonic_time); |
147 void PromoteStartedAnimations(double monotonic_time, | 147 void PromoteStartedAnimations(base::TimeTicks monotonic_time, |
148 AnimationEventsVector* events); | 148 AnimationEventsVector* events); |
149 void MarkFinishedAnimations(double monotonic_time); | 149 void MarkFinishedAnimations(base::TimeTicks monotonic_time); |
150 void MarkAnimationsForDeletion(double monotonic_time, | 150 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, |
151 AnimationEventsVector* events); | 151 AnimationEventsVector* events); |
152 void PurgeAnimationsMarkedForDeletion(); | 152 void PurgeAnimationsMarkedForDeletion(); |
153 | 153 |
154 void TickAnimations(double monotonic_time); | 154 void TickAnimations(base::TimeTicks monotonic_time); |
155 | 155 |
156 enum UpdateActivationType { | 156 enum UpdateActivationType { |
157 NormalActivation, | 157 NormalActivation, |
158 ForceActivation | 158 ForceActivation |
159 }; | 159 }; |
160 void UpdateActivation(UpdateActivationType type); | 160 void UpdateActivation(UpdateActivationType type); |
161 | 161 |
162 void NotifyObserversOpacityAnimated(float opacity); | 162 void NotifyObserversOpacityAnimated(float opacity); |
163 void NotifyObserversTransformAnimated(const gfx::Transform& transform); | 163 void NotifyObserversTransformAnimated(const gfx::Transform& transform); |
164 void NotifyObserversFilterAnimated(const FilterOperations& filter); | 164 void NotifyObserversFilterAnimated(const FilterOperations& filter); |
165 void NotifyObserversScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset); | 165 void NotifyObserversScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset); |
166 | 166 |
167 void NotifyObserversAnimationWaitingForDeletion(); | 167 void NotifyObserversAnimationWaitingForDeletion(); |
168 | 168 |
169 bool HasValueObserver(); | 169 bool HasValueObserver(); |
170 bool HasActiveValueObserver(); | 170 bool HasActiveValueObserver(); |
171 | 171 |
172 AnimationRegistrar* registrar_; | 172 AnimationRegistrar* registrar_; |
173 int id_; | 173 int id_; |
174 ScopedPtrVector<Animation> active_animations_; | 174 ScopedPtrVector<Animation> active_animations_; |
175 | 175 |
176 // This is used to ensure that we don't spam the registrar. | 176 // This is used to ensure that we don't spam the registrar. |
177 bool is_active_; | 177 bool is_active_; |
178 | 178 |
179 double last_tick_time_; | 179 base::TimeTicks last_tick_time_; |
180 | 180 |
181 ObserverList<LayerAnimationValueObserver> value_observers_; | 181 ObserverList<LayerAnimationValueObserver> value_observers_; |
182 ObserverList<LayerAnimationEventObserver> event_observers_; | 182 ObserverList<LayerAnimationEventObserver> event_observers_; |
183 | 183 |
184 LayerAnimationValueProvider* value_provider_; | 184 LayerAnimationValueProvider* value_provider_; |
185 | 185 |
186 AnimationDelegate* layer_animation_delegate_; | 186 AnimationDelegate* layer_animation_delegate_; |
187 | 187 |
188 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 188 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
189 }; | 189 }; |
190 | 190 |
191 } // namespace cc | 191 } // namespace cc |
192 | 192 |
193 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 193 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
OLD | NEW |