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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 132 |
133 bool HasOnlyTranslationTransforms() const; | 133 bool HasOnlyTranslationTransforms() const; |
134 | 134 |
135 bool AnimationsPreserveAxisAlignment() const; | 135 bool AnimationsPreserveAxisAlignment() const; |
136 | 136 |
137 // Sets |max_scale| to the maximum scale along any dimension at any | 137 // Sets |max_scale| to the maximum scale along any dimension at any |
138 // destination in active animations. Returns false if the maximum scale cannot | 138 // destination in active animations. Returns false if the maximum scale cannot |
139 // be computed. | 139 // be computed. |
140 bool MaximumTargetScale(float* max_scale) const; | 140 bool MaximumTargetScale(float* max_scale) const; |
141 | 141 |
142 // When a scroll animation is removed on the main thread, its compositor | |
aelias_OOO_until_Jul13
2015/01/21 21:23:52
I'd add the comment "This is to provide the illusi
ajuma
2015/01/21 21:50:27
Done.
| |
143 // thread counterpart continues producing scroll deltas until activation. | |
144 // These scroll deltas need to be cleared at activation, so that the active | |
145 // layer's scroll offset matches the offset provided by the main thread | |
146 // rather than a combination of this offset and scroll deltas produced by | |
147 // the removed animation. | |
148 bool clear_scroll_delta_for_removed_animation() const { | |
aelias_OOO_until_Jul13
2015/01/21 21:23:52
Could you rename this and the field to "animation_
ajuma
2015/01/21 21:50:27
Done.
| |
149 return clear_scroll_delta_for_removed_animation_; | |
150 } | |
151 | |
142 bool needs_to_start_animations_for_testing() { | 152 bool needs_to_start_animations_for_testing() { |
143 return needs_to_start_animations_; | 153 return needs_to_start_animations_; |
144 } | 154 } |
145 | 155 |
146 protected: | 156 protected: |
147 friend class base::RefCounted<LayerAnimationController>; | 157 friend class base::RefCounted<LayerAnimationController>; |
148 | 158 |
149 explicit LayerAnimationController(int id); | 159 explicit LayerAnimationController(int id); |
150 virtual ~LayerAnimationController(); | 160 virtual ~LayerAnimationController(); |
151 | 161 |
152 private: | 162 private: |
153 typedef base::hash_set<int> TargetProperties; | 163 typedef base::hash_set<int> TargetProperties; |
154 | 164 |
155 void PushNewAnimationsToImplThread( | 165 void PushNewAnimationsToImplThread( |
156 LayerAnimationController* controller_impl) const; | 166 LayerAnimationController* controller_impl) const; |
157 void RemoveAnimationsCompletedOnMainThread( | 167 void RemoveAnimationsCompletedOnMainThread( |
158 LayerAnimationController* controller_impl) const; | 168 LayerAnimationController* controller_impl) const; |
159 void PushPropertiesToImplThread( | 169 void PushPropertiesToImplThread(LayerAnimationController* controller_impl); |
160 LayerAnimationController* controller_impl) const; | |
161 | 170 |
162 void StartAnimations(base::TimeTicks monotonic_time); | 171 void StartAnimations(base::TimeTicks monotonic_time); |
163 void PromoteStartedAnimations(base::TimeTicks monotonic_time, | 172 void PromoteStartedAnimations(base::TimeTicks monotonic_time, |
164 AnimationEventsVector* events); | 173 AnimationEventsVector* events); |
165 void MarkFinishedAnimations(base::TimeTicks monotonic_time); | 174 void MarkFinishedAnimations(base::TimeTicks monotonic_time); |
166 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, | 175 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, |
167 AnimationEventsVector* events); | 176 AnimationEventsVector* events); |
168 void PurgeAnimationsMarkedForDeletion(); | 177 void PurgeAnimationsMarkedForDeletion(); |
169 | 178 |
170 void TickAnimations(base::TimeTicks monotonic_time); | 179 void TickAnimations(base::TimeTicks monotonic_time); |
(...skipping 13 matching lines...) Expand all Loading... | |
184 void NotifyObserversFilterAnimated(const FilterOperations& filter, | 193 void NotifyObserversFilterAnimated(const FilterOperations& filter, |
185 bool notify_active_observers, | 194 bool notify_active_observers, |
186 bool notify_pending_observers); | 195 bool notify_pending_observers); |
187 void NotifyObserversScrollOffsetAnimated( | 196 void NotifyObserversScrollOffsetAnimated( |
188 const gfx::ScrollOffset& scroll_offset, | 197 const gfx::ScrollOffset& scroll_offset, |
189 bool notify_active_observers, | 198 bool notify_active_observers, |
190 bool notify_pending_observers); | 199 bool notify_pending_observers); |
191 | 200 |
192 void NotifyObserversAnimationWaitingForDeletion(); | 201 void NotifyObserversAnimationWaitingForDeletion(); |
193 | 202 |
194 void NotifyObserversScrollOffsetAnimationRemoved(); | |
195 | |
196 bool HasValueObserver(); | 203 bool HasValueObserver(); |
197 bool HasActiveValueObserver(); | 204 bool HasActiveValueObserver(); |
198 | 205 |
199 AnimationRegistrar* registrar_; | 206 AnimationRegistrar* registrar_; |
200 int id_; | 207 int id_; |
201 ScopedPtrVector<Animation> animations_; | 208 ScopedPtrVector<Animation> animations_; |
202 | 209 |
203 // This is used to ensure that we don't spam the registrar. | 210 // This is used to ensure that we don't spam the registrar. |
204 bool is_active_; | 211 bool is_active_; |
205 | 212 |
206 base::TimeTicks last_tick_time_; | 213 base::TimeTicks last_tick_time_; |
207 | 214 |
208 ObserverList<LayerAnimationValueObserver> value_observers_; | 215 ObserverList<LayerAnimationValueObserver> value_observers_; |
209 ObserverList<LayerAnimationEventObserver> event_observers_; | 216 ObserverList<LayerAnimationEventObserver> event_observers_; |
210 | 217 |
211 LayerAnimationValueProvider* value_provider_; | 218 LayerAnimationValueProvider* value_provider_; |
212 | 219 |
213 AnimationDelegate* layer_animation_delegate_; | 220 AnimationDelegate* layer_animation_delegate_; |
214 | 221 |
215 // Only try to start animations when new animations are added or when the | 222 // Only try to start animations when new animations are added or when the |
216 // previous attempt at starting animations failed to start all animations. | 223 // previous attempt at starting animations failed to start all animations. |
217 bool needs_to_start_animations_; | 224 bool needs_to_start_animations_; |
218 | 225 |
226 bool clear_scroll_delta_for_removed_animation_; | |
227 | |
219 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 228 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
220 }; | 229 }; |
221 | 230 |
222 } // namespace cc | 231 } // namespace cc |
223 | 232 |
224 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 233 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
OLD | NEW |