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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // same-property animations. | 32 // same-property animations. |
33 // Each AnimationPlayer has its copy on the impl thread. | 33 // Each AnimationPlayer has its copy on the impl thread. |
34 // This is a CC counterpart for blink::AnimationPlayer (in 1:1 relationship). | 34 // This is a CC counterpart for blink::AnimationPlayer (in 1:1 relationship). |
35 class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>, | 35 class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>, |
36 public base::LinkNode<AnimationPlayer> { | 36 public base::LinkNode<AnimationPlayer> { |
37 public: | 37 public: |
38 static scoped_refptr<AnimationPlayer> Create(int id); | 38 static scoped_refptr<AnimationPlayer> Create(int id); |
39 scoped_refptr<AnimationPlayer> CreateImplInstance() const; | 39 scoped_refptr<AnimationPlayer> CreateImplInstance() const; |
40 | 40 |
41 int id() const { return id_; } | 41 int id() const { return id_; } |
42 int layer_id() const { return layer_id_; } | 42 ElementId element_id() const { return element_id_; } |
43 | 43 |
44 // Parent AnimationHost. AnimationPlayer can be detached from | 44 // Parent AnimationHost. AnimationPlayer can be detached from |
45 // AnimationTimeline. | 45 // AnimationTimeline. |
46 AnimationHost* animation_host() { return animation_host_; } | 46 AnimationHost* animation_host() { return animation_host_; } |
47 const AnimationHost* animation_host() const { return animation_host_; } | 47 const AnimationHost* animation_host() const { return animation_host_; } |
48 void SetAnimationHost(AnimationHost* animation_host); | 48 void SetAnimationHost(AnimationHost* animation_host); |
49 | 49 |
50 // Parent AnimationTimeline. | 50 // Parent AnimationTimeline. |
51 AnimationTimeline* animation_timeline() { return animation_timeline_; } | 51 AnimationTimeline* animation_timeline() { return animation_timeline_; } |
52 const AnimationTimeline* animation_timeline() const { | 52 const AnimationTimeline* animation_timeline() const { |
53 return animation_timeline_; | 53 return animation_timeline_; |
54 } | 54 } |
55 void SetAnimationTimeline(AnimationTimeline* timeline); | 55 void SetAnimationTimeline(AnimationTimeline* timeline); |
56 | 56 |
57 // ElementAnimations object where this player is listed. | 57 // ElementAnimations object where this player is listed. |
58 scoped_refptr<ElementAnimations> element_animations() const { | 58 scoped_refptr<ElementAnimations> element_animations() const { |
59 return element_animations_; | 59 return element_animations_; |
60 } | 60 } |
61 | 61 |
62 void set_layer_animation_delegate(AnimationDelegate* delegate) { | 62 void set_layer_animation_delegate(AnimationDelegate* delegate) { |
63 layer_animation_delegate_ = delegate; | 63 layer_animation_delegate_ = delegate; |
64 } | 64 } |
65 | 65 |
66 void AttachLayer(int layer_id); | 66 void AttachLayer(ElementId element_id); |
67 void DetachLayer(); | 67 void DetachLayer(); |
68 | 68 |
69 void AddAnimation(std::unique_ptr<Animation> animation); | 69 void AddAnimation(std::unique_ptr<Animation> animation); |
70 void PauseAnimation(int animation_id, double time_offset); | 70 void PauseAnimation(int animation_id, double time_offset); |
71 void RemoveAnimation(int animation_id); | 71 void RemoveAnimation(int animation_id); |
72 void AbortAnimation(int animation_id); | 72 void AbortAnimation(int animation_id); |
73 void AbortAnimations(TargetProperty::Type target_property, | 73 void AbortAnimations(TargetProperty::Type target_property, |
74 bool needs_completion); | 74 bool needs_completion); |
75 | 75 |
76 void PushPropertiesTo(AnimationPlayer* player_impl); | 76 void PushPropertiesTo(AnimationPlayer* player_impl); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // to non-attached AnimationPlayers. | 114 // to non-attached AnimationPlayers. |
115 std::vector<std::unique_ptr<Animation>> animations_; | 115 std::vector<std::unique_ptr<Animation>> animations_; |
116 | 116 |
117 AnimationHost* animation_host_; | 117 AnimationHost* animation_host_; |
118 AnimationTimeline* animation_timeline_; | 118 AnimationTimeline* animation_timeline_; |
119 // element_animations isn't null if player attached to an element (layer). | 119 // element_animations isn't null if player attached to an element (layer). |
120 scoped_refptr<ElementAnimations> element_animations_; | 120 scoped_refptr<ElementAnimations> element_animations_; |
121 AnimationDelegate* layer_animation_delegate_; | 121 AnimationDelegate* layer_animation_delegate_; |
122 | 122 |
123 int id_; | 123 int id_; |
124 int layer_id_; | 124 ElementId element_id_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); | 126 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace cc | 129 } // namespace cc |
130 | 130 |
131 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ | 131 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |
OLD | NEW |