| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(TargetProperty::Type target_property, | 50 void AbortAnimations(TargetProperty::Type target_property, |
| 51 bool needs_completion = false); | 51 bool needs_completion = false); |
| 52 | 52 |
| 53 // Ensures that the list of active animations on the main thread and the impl | 53 // Ensures that the list of active animations on the main thread and the impl |
| 54 // thread are kept in sync. This function does not take ownership of the impl | 54 // thread are kept in sync. This function does not take ownership of the impl |
| 55 // thread controller. This method is virtual for testing. | 55 // thread controller. |
| 56 virtual void PushAnimationUpdatesTo( | 56 void PushAnimationUpdatesTo(LayerAnimationController* controller_impl); |
| 57 LayerAnimationController* controller_impl); | |
| 58 | 57 |
| 59 void Animate(base::TimeTicks monotonic_time); | 58 void Animate(base::TimeTicks monotonic_time); |
| 60 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time, | 59 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time, |
| 61 AnimationEvents* events); | 60 AnimationEvents* events); |
| 62 | 61 |
| 63 void UpdateState(bool start_ready_animations, AnimationEvents* events); | 62 void UpdateState(bool start_ready_animations, AnimationEvents* events); |
| 64 | 63 |
| 65 // Make animations affect active observers if and only if they affect | 64 // Make animations affect active observers if and only if they affect |
| 66 // pending observers. Any animations that no longer affect any observers | 65 // pending observers. Any animations that no longer affect any observers |
| 67 // are deleted. | 66 // are deleted. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // the removed animation. This is to provide the illusion of synchronicity to | 162 // the removed animation. This is to provide the illusion of synchronicity to |
| 164 // JS that simultaneously removes an animation and sets the scroll offset. | 163 // JS that simultaneously removes an animation and sets the scroll offset. |
| 165 bool scroll_offset_animation_was_interrupted() const { | 164 bool scroll_offset_animation_was_interrupted() const { |
| 166 return scroll_offset_animation_was_interrupted_; | 165 return scroll_offset_animation_was_interrupted_; |
| 167 } | 166 } |
| 168 | 167 |
| 169 bool needs_to_start_animations_for_testing() { | 168 bool needs_to_start_animations_for_testing() { |
| 170 return needs_to_start_animations_; | 169 return needs_to_start_animations_; |
| 171 } | 170 } |
| 172 | 171 |
| 173 protected: | 172 private: |
| 174 friend class base::RefCounted<LayerAnimationController>; | 173 friend class base::RefCounted<LayerAnimationController>; |
| 175 | 174 |
| 176 explicit LayerAnimationController(int id); | 175 explicit LayerAnimationController(int id); |
| 177 virtual ~LayerAnimationController(); | 176 ~LayerAnimationController(); |
| 178 | 177 |
| 179 private: | |
| 180 using TargetProperties = std::unordered_set<int>; | 178 using TargetProperties = std::unordered_set<int>; |
| 181 | 179 |
| 182 void PushNewAnimationsToImplThread( | 180 void PushNewAnimationsToImplThread( |
| 183 LayerAnimationController* controller_impl) const; | 181 LayerAnimationController* controller_impl) const; |
| 184 void MarkAbortedAnimationsForDeletion( | 182 void MarkAbortedAnimationsForDeletion( |
| 185 LayerAnimationController* controller_impl) const; | 183 LayerAnimationController* controller_impl) const; |
| 186 void RemoveAnimationsCompletedOnMainThread( | 184 void RemoveAnimationsCompletedOnMainThread( |
| 187 LayerAnimationController* controller_impl) const; | 185 LayerAnimationController* controller_impl) const; |
| 188 void PushPropertiesToImplThread(LayerAnimationController* controller_impl); | 186 void PushPropertiesToImplThread(LayerAnimationController* controller_impl); |
| 189 | 187 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 247 |
| 250 bool potentially_animating_transform_for_active_observers_; | 248 bool potentially_animating_transform_for_active_observers_; |
| 251 bool potentially_animating_transform_for_pending_observers_; | 249 bool potentially_animating_transform_for_pending_observers_; |
| 252 | 250 |
| 253 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 251 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
| 254 }; | 252 }; |
| 255 | 253 |
| 256 } // namespace cc | 254 } // namespace cc |
| 257 | 255 |
| 258 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 256 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |