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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // ElementAnimations has a reference to shared LayerAnimationController. | 59 // ElementAnimations has a reference to shared LayerAnimationController. |
60 ElementAnimations* element_animations() const { return element_animations_; } | 60 ElementAnimations* element_animations() const { return element_animations_; } |
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(int layer_id); |
67 void DetachLayer(); | 67 void DetachLayer(); |
68 | 68 |
69 void AddAnimation(scoped_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); |
77 | 77 |
78 // AnimationDelegate routing. | 78 // AnimationDelegate routing. |
79 void NotifyAnimationStarted(base::TimeTicks monotonic_time, | 79 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
80 TargetProperty::Type target_property, | 80 TargetProperty::Type target_property, |
81 int group); | 81 int group); |
82 void NotifyAnimationFinished(base::TimeTicks monotonic_time, | 82 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
83 TargetProperty::Type target_property, | 83 TargetProperty::Type target_property, |
84 int group); | 84 int group); |
85 void NotifyAnimationAborted(base::TimeTicks monotonic_time, | 85 void NotifyAnimationAborted(base::TimeTicks monotonic_time, |
86 TargetProperty::Type target_property, | 86 TargetProperty::Type target_property, |
87 int group); | 87 int group); |
88 void NotifyAnimationTakeover(base::TimeTicks monotonic_time, | 88 void NotifyAnimationTakeover(base::TimeTicks monotonic_time, |
89 TargetProperty::Type target_property, | 89 TargetProperty::Type target_property, |
90 double animation_start_time, | 90 double animation_start_time, |
91 scoped_ptr<AnimationCurve> curve); | 91 std::unique_ptr<AnimationCurve> curve); |
92 | 92 |
93 // Whether this player has animations waiting to get sent to LAC. | 93 // Whether this player has animations waiting to get sent to LAC. |
94 bool has_pending_animations_for_testing() const { | 94 bool has_pending_animations_for_testing() const { |
95 return !animations_.empty(); | 95 return !animations_.empty(); |
96 } | 96 } |
97 | 97 |
98 private: | 98 private: |
99 friend class base::RefCounted<AnimationPlayer>; | 99 friend class base::RefCounted<AnimationPlayer>; |
100 | 100 |
101 explicit AnimationPlayer(int id); | 101 explicit AnimationPlayer(int id); |
102 ~AnimationPlayer(); | 102 ~AnimationPlayer(); |
103 | 103 |
104 void SetNeedsCommit(); | 104 void SetNeedsCommit(); |
105 | 105 |
106 void RegisterPlayer(); | 106 void RegisterPlayer(); |
107 void UnregisterPlayer(); | 107 void UnregisterPlayer(); |
108 | 108 |
109 void BindElementAnimations(); | 109 void BindElementAnimations(); |
110 void UnbindElementAnimations(); | 110 void UnbindElementAnimations(); |
111 | 111 |
112 // We accumulate added animations in animations_ container | 112 // We accumulate added animations in animations_ container |
113 // if element_animations_ is a nullptr. It allows us to add/remove animations | 113 // if element_animations_ is a nullptr. It allows us to add/remove animations |
114 // to non-attached AnimationPlayers. | 114 // to non-attached AnimationPlayers. |
115 std::vector<scoped_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 ElementAnimations* element_animations_; | 120 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 int layer_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 |