| 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/containers/linked_list.h" | 10 #include "base/containers/linked_list.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "cc/animation/animation.h" | 14 #include "cc/animation/animation.h" |
| 15 #include "cc/animation/animation_curve.h" | 15 #include "cc/animation/animation_curve.h" |
| 16 #include "cc/animation/element_animations.h" |
| 16 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class AnimationDelegate; | 21 class AnimationDelegate; |
| 21 class AnimationHost; | 22 class AnimationHost; |
| 22 class AnimationTimeline; | 23 class AnimationTimeline; |
| 23 class ElementAnimations; | 24 class ElementAnimations; |
| 24 class LayerAnimationController; | 25 class LayerAnimationController; |
| 25 enum class LayerTreeType; | 26 enum class LayerTreeType; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 void SetAnimationHost(AnimationHost* animation_host); | 50 void SetAnimationHost(AnimationHost* animation_host); |
| 50 | 51 |
| 51 // Parent AnimationTimeline. | 52 // Parent AnimationTimeline. |
| 52 AnimationTimeline* animation_timeline() { return animation_timeline_; } | 53 AnimationTimeline* animation_timeline() { return animation_timeline_; } |
| 53 const AnimationTimeline* animation_timeline() const { | 54 const AnimationTimeline* animation_timeline() const { |
| 54 return animation_timeline_; | 55 return animation_timeline_; |
| 55 } | 56 } |
| 56 void SetAnimationTimeline(AnimationTimeline* timeline); | 57 void SetAnimationTimeline(AnimationTimeline* timeline); |
| 57 | 58 |
| 58 // ElementAnimations object where this player is listed. | 59 // ElementAnimations object where this player is listed. |
| 59 // ElementAnimations has a reference to shared LayerAnimationController. | 60 scoped_refptr<ElementAnimations> element_animations() const { |
| 60 ElementAnimations* element_animations() const { return element_animations_; } | 61 return element_animations_; |
| 62 } |
| 61 | 63 |
| 62 void set_layer_animation_delegate(AnimationDelegate* delegate) { | 64 void set_layer_animation_delegate(AnimationDelegate* delegate) { |
| 63 layer_animation_delegate_ = delegate; | 65 layer_animation_delegate_ = delegate; |
| 64 } | 66 } |
| 65 | 67 |
| 66 void AttachLayer(int layer_id); | 68 void AttachLayer(int layer_id); |
| 67 void DetachLayer(); | 69 void DetachLayer(); |
| 68 | 70 |
| 69 void AddAnimation(std::unique_ptr<Animation> animation); | 71 void AddAnimation(std::unique_ptr<Animation> animation); |
| 70 void PauseAnimation(int animation_id, double time_offset); | 72 void PauseAnimation(int animation_id, double time_offset); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 void UnbindElementAnimations(); | 112 void UnbindElementAnimations(); |
| 111 | 113 |
| 112 // We accumulate added animations in animations_ container | 114 // We accumulate added animations in animations_ container |
| 113 // if element_animations_ is a nullptr. It allows us to add/remove animations | 115 // if element_animations_ is a nullptr. It allows us to add/remove animations |
| 114 // to non-attached AnimationPlayers. | 116 // to non-attached AnimationPlayers. |
| 115 std::vector<std::unique_ptr<Animation>> animations_; | 117 std::vector<std::unique_ptr<Animation>> animations_; |
| 116 | 118 |
| 117 AnimationHost* animation_host_; | 119 AnimationHost* animation_host_; |
| 118 AnimationTimeline* animation_timeline_; | 120 AnimationTimeline* animation_timeline_; |
| 119 // element_animations isn't null if player attached to an element (layer). | 121 // element_animations isn't null if player attached to an element (layer). |
| 120 ElementAnimations* element_animations_; | 122 scoped_refptr<ElementAnimations> element_animations_; |
| 121 AnimationDelegate* layer_animation_delegate_; | 123 AnimationDelegate* layer_animation_delegate_; |
| 122 | 124 |
| 123 int id_; | 125 int id_; |
| 124 int layer_id_; | 126 int layer_id_; |
| 125 | 127 |
| 126 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); | 128 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
| 127 }; | 129 }; |
| 128 | 130 |
| 129 } // namespace cc | 131 } // namespace cc |
| 130 | 132 |
| 131 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ | 133 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |
| OLD | NEW |