| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANIMATION_PLAYER_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ |
| 6 #define CC_ANIMATION_ANIMATION_PLAYER_H_ | 6 #define CC_ANIMATION_ANIMATION_PLAYER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 void AddAnimation(std::unique_ptr<Animation> animation); | 70 void AddAnimation(std::unique_ptr<Animation> animation); |
| 71 void PauseAnimation(int animation_id, double time_offset); | 71 void PauseAnimation(int animation_id, double time_offset); |
| 72 void RemoveAnimation(int animation_id); | 72 void RemoveAnimation(int animation_id); |
| 73 void AbortAnimation(int animation_id); | 73 void AbortAnimation(int animation_id); |
| 74 void AbortAnimations(TargetProperty::Type target_property, | 74 void AbortAnimations(TargetProperty::Type target_property, |
| 75 bool needs_completion); | 75 bool needs_completion); |
| 76 | 76 |
| 77 void PushPropertiesTo(AnimationPlayer* player_impl); | 77 void PushPropertiesTo(AnimationPlayer* player_impl); |
| 78 | 78 |
| 79 void Animate(base::TimeTicks monotonic_time); | 79 void Tick(base::TimeTicks monotonic_time); |
| 80 void UpdateState(bool start_ready_animations, AnimationEvents* events); | 80 void UpdateState(bool start_ready_animations, AnimationEvents* events); |
| 81 | 81 |
| 82 void UpdateActivation(ActivationType type); | 82 void UpdateTickingState(UpdateTickingType type); |
| 83 void Deactivate(); | 83 void RemoveFromTicking(); |
| 84 | 84 |
| 85 // AnimationDelegate routing. | 85 // AnimationDelegate routing. |
| 86 bool NotifyAnimationStarted(const AnimationEvent& event); | 86 bool NotifyAnimationStarted(const AnimationEvent& event); |
| 87 bool NotifyAnimationFinished(const AnimationEvent& event); | 87 bool NotifyAnimationFinished(const AnimationEvent& event); |
| 88 bool NotifyAnimationAborted(const AnimationEvent& event); | 88 bool NotifyAnimationAborted(const AnimationEvent& event); |
| 89 void NotifyAnimationTakeover(const AnimationEvent& event); | 89 void NotifyAnimationTakeover(const AnimationEvent& event); |
| 90 bool NotifyAnimationFinishedForTesting(TargetProperty::Type target_property, | 90 bool NotifyAnimationFinishedForTesting(TargetProperty::Type target_property, |
| 91 int group_id); | 91 int group_id); |
| 92 | 92 |
| 93 // Returns true if there are any animations that have neither finished nor | 93 // Returns true if there are any animations that have neither finished nor |
| 94 // aborted. | 94 // aborted. |
| 95 bool HasActiveAnimation() const; | 95 bool HasTickingAnimation() const; |
| 96 | 96 |
| 97 // Returns true if there are any animations at all to process. | 97 // Returns true if there are any animations at all to process. |
| 98 bool has_any_animation() const { return !animations_.empty(); } | 98 bool has_any_animation() const { return !animations_.empty(); } |
| 99 | 99 |
| 100 bool needs_push_properties() const { return needs_push_properties_; } | 100 bool needs_push_properties() const { return needs_push_properties_; } |
| 101 void SetNeedsPushProperties(); | 101 void SetNeedsPushProperties(); |
| 102 | 102 |
| 103 bool HasNonDeletedAnimation() const; | 103 bool HasNonDeletedAnimation() const; |
| 104 | 104 |
| 105 bool needs_to_start_animations() const { return needs_to_start_animations_; } | 105 bool needs_to_start_animations() const { return needs_to_start_animations_; } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 ElementListType list_type) const; | 142 ElementListType list_type) const; |
| 143 | 143 |
| 144 // Returns true if there is an animation that is currently animating the given | 144 // Returns true if there is an animation that is currently animating the given |
| 145 // property and that affects the given tree type. | 145 // property and that affects the given tree type. |
| 146 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, | 146 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, |
| 147 ElementListType list_type) const; | 147 ElementListType list_type) const; |
| 148 | 148 |
| 149 bool HasElementInActiveList() const; | 149 bool HasElementInActiveList() const; |
| 150 gfx::ScrollOffset ScrollOffsetForAnimation() const; | 150 gfx::ScrollOffset ScrollOffsetForAnimation() const; |
| 151 | 151 |
| 152 // Returns the active animation animating the given property that is either | 152 // Returns the animation animating the given property that is either |
| 153 // running, or is next to run, if such an animation exists. | 153 // running, or is next to run, if such an animation exists. |
| 154 Animation* GetAnimation(TargetProperty::Type target_property) const; | 154 Animation* GetAnimation(TargetProperty::Type target_property) const; |
| 155 | 155 |
| 156 // Returns the active animation for the given unique animation id. | 156 // Returns animation for the given unique animation id. |
| 157 Animation* GetAnimationById(int animation_id) const; | 157 Animation* GetAnimationById(int animation_id) const; |
| 158 | 158 |
| 159 void GetPropertyAnimationState(PropertyAnimationState* pending_state, | 159 void GetPropertyAnimationState(PropertyAnimationState* pending_state, |
| 160 PropertyAnimationState* active_state) const; | 160 PropertyAnimationState* active_state) const; |
| 161 | 161 |
| 162 // When a scroll animation is removed on the main thread, its compositor | 162 // When a scroll animation is removed on the main thread, its compositor |
| 163 // thread counterpart continues producing scroll deltas until activation. | 163 // thread counterpart continues producing scroll deltas until activation. |
| 164 // These scroll deltas need to be cleared at activation, so that the active | 164 // These scroll deltas need to be cleared at activation, so that the active |
| 165 // element's scroll offset matches the offset provided by the main thread | 165 // element's scroll offset matches the offset provided by the main thread |
| 166 // rather than a combination of this offset and scroll deltas produced by | 166 // rather than a combination of this offset and scroll deltas produced by |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 int id_; | 207 int id_; |
| 208 ElementId element_id_; | 208 ElementId element_id_; |
| 209 bool needs_push_properties_; | 209 bool needs_push_properties_; |
| 210 base::TimeTicks last_tick_time_; | 210 base::TimeTicks last_tick_time_; |
| 211 | 211 |
| 212 // Only try to start animations when new animations are added or when the | 212 // Only try to start animations when new animations are added or when the |
| 213 // previous attempt at starting animations failed to start all animations. | 213 // previous attempt at starting animations failed to start all animations. |
| 214 bool needs_to_start_animations_; | 214 bool needs_to_start_animations_; |
| 215 | 215 |
| 216 // This is used to ensure that we don't spam the animation host. | 216 // This is used to ensure that we don't spam the animation host. |
| 217 bool is_active_; | 217 bool is_ticking_; |
| 218 | 218 |
| 219 bool scroll_offset_animation_was_interrupted_; | 219 bool scroll_offset_animation_was_interrupted_; |
| 220 | 220 |
| 221 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); | 221 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 } // namespace cc | 224 } // namespace cc |
| 225 | 225 |
| 226 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ | 226 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |
| OLD | NEW |