| 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_ELEMENT_ANIMATIONS_H_ | 5 #ifndef CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
| 6 #define CC_ANIMATION_ELEMENT_ANIMATIONS_H_ | 6 #define CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
| 7 | 7 |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 enum class LayerTreeType; | 36 enum class LayerTreeType; |
| 37 | 37 |
| 38 // An ElementAnimations owns a list of all AnimationPlayers, attached to | 38 // An ElementAnimations owns a list of all AnimationPlayers, attached to |
| 39 // the layer. | 39 // the layer. |
| 40 // This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship). | 40 // This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship). |
| 41 // No pointer to/from respective blink::ElementAnimations object for now. | 41 // No pointer to/from respective blink::ElementAnimations object for now. |
| 42 class CC_EXPORT ElementAnimations : public base::RefCounted<ElementAnimations> { | 42 class CC_EXPORT ElementAnimations : public base::RefCounted<ElementAnimations> { |
| 43 public: | 43 public: |
| 44 static scoped_refptr<ElementAnimations> Create(); | 44 static scoped_refptr<ElementAnimations> Create(); |
| 45 | 45 |
| 46 int layer_id() const { return layer_id_; } | 46 ElementId element_id() const { return element_id_; } |
| 47 void SetLayerId(int layer_id); | 47 void SetElementId(ElementId element_id); |
| 48 | 48 |
| 49 // Parent AnimationHost. | 49 // Parent AnimationHost. |
| 50 AnimationHost* animation_host() { return animation_host_; } | 50 AnimationHost* animation_host() { return animation_host_; } |
| 51 const AnimationHost* animation_host() const { return animation_host_; } | 51 const AnimationHost* animation_host() const { return animation_host_; } |
| 52 void SetAnimationHost(AnimationHost* host); | 52 void SetAnimationHost(AnimationHost* host); |
| 53 | 53 |
| 54 void InitAffectedElementTypes(); | 54 void InitAffectedElementTypes(); |
| 55 void ClearAffectedElementTypes(); | 55 void ClearAffectedElementTypes(); |
| 56 | 56 |
| 57 void LayerRegistered(int layer_id, LayerTreeType tree_type); | 57 void LayerRegistered(ElementId element_id, LayerTreeType tree_type); |
| 58 void LayerUnregistered(int layer_id, LayerTreeType tree_type); | 58 void LayerUnregistered(ElementId element_id, LayerTreeType tree_type); |
| 59 | 59 |
| 60 void AddPlayer(AnimationPlayer* player); | 60 void AddPlayer(AnimationPlayer* player); |
| 61 void RemovePlayer(AnimationPlayer* player); | 61 void RemovePlayer(AnimationPlayer* player); |
| 62 bool IsEmpty() const; | 62 bool IsEmpty() const; |
| 63 | 63 |
| 64 typedef base::LinkedList<AnimationPlayer> PlayersList; | 64 typedef base::LinkedList<AnimationPlayer> PlayersList; |
| 65 typedef base::LinkNode<AnimationPlayer> PlayersListNode; | 65 typedef base::LinkNode<AnimationPlayer> PlayersListNode; |
| 66 const PlayersList& players_list() const { return *players_list_.get(); } | 66 const PlayersList& players_list() const { return *players_list_.get(); } |
| 67 | 67 |
| 68 // Ensures that the list of active animations on the main thread and the impl | 68 // Ensures that the list of active animations on the main thread and the impl |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 TargetProperty::Type target_property, | 251 TargetProperty::Type target_property, |
| 252 int group); | 252 int group); |
| 253 void NotifyPlayersAnimationPropertyUpdate(const AnimationEvent& event); | 253 void NotifyPlayersAnimationPropertyUpdate(const AnimationEvent& event); |
| 254 void NotifyPlayersAnimationTakeover(base::TimeTicks monotonic_time, | 254 void NotifyPlayersAnimationTakeover(base::TimeTicks monotonic_time, |
| 255 TargetProperty::Type target_property, | 255 TargetProperty::Type target_property, |
| 256 double animation_start_time, | 256 double animation_start_time, |
| 257 std::unique_ptr<AnimationCurve> curve); | 257 std::unique_ptr<AnimationCurve> curve); |
| 258 | 258 |
| 259 std::unique_ptr<PlayersList> players_list_; | 259 std::unique_ptr<PlayersList> players_list_; |
| 260 AnimationHost* animation_host_; | 260 AnimationHost* animation_host_; |
| 261 int layer_id_; | 261 ElementId element_id_; |
| 262 std::vector<std::unique_ptr<Animation>> animations_; | 262 std::vector<std::unique_ptr<Animation>> animations_; |
| 263 | 263 |
| 264 // This is used to ensure that we don't spam the animation host. | 264 // This is used to ensure that we don't spam the animation host. |
| 265 bool is_active_; | 265 bool is_active_; |
| 266 | 266 |
| 267 base::TimeTicks last_tick_time_; | 267 base::TimeTicks last_tick_time_; |
| 268 | 268 |
| 269 bool has_element_in_active_list_; | 269 bool has_element_in_active_list_; |
| 270 bool has_element_in_pending_list_; | 270 bool has_element_in_pending_list_; |
| 271 | 271 |
| 272 // Only try to start animations when new animations are added or when the | 272 // Only try to start animations when new animations are added or when the |
| 273 // previous attempt at starting animations failed to start all animations. | 273 // previous attempt at starting animations failed to start all animations. |
| 274 bool needs_to_start_animations_; | 274 bool needs_to_start_animations_; |
| 275 | 275 |
| 276 bool scroll_offset_animation_was_interrupted_; | 276 bool scroll_offset_animation_was_interrupted_; |
| 277 | 277 |
| 278 bool potentially_animating_transform_for_active_elements_; | 278 bool potentially_animating_transform_for_active_elements_; |
| 279 bool potentially_animating_transform_for_pending_elements_; | 279 bool potentially_animating_transform_for_pending_elements_; |
| 280 | 280 |
| 281 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); | 281 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 } // namespace cc | 284 } // namespace cc |
| 285 | 285 |
| 286 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ | 286 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
| OLD | NEW |