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_HOST_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_HOST_H_ |
6 #define CC_ANIMATION_ANIMATION_HOST_H_ | 6 #define CC_ANIMATION_ANIMATION_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 scoped_refptr<ElementAnimations> GetElementAnimationsForElementId( | 72 scoped_refptr<ElementAnimations> GetElementAnimationsForElementId( |
73 ElementId element_id) const; | 73 ElementId element_id) const; |
74 | 74 |
75 // Parent LayerTreeHost or LayerTreeHostImpl. | 75 // Parent LayerTreeHost or LayerTreeHostImpl. |
76 MutatorHostClient* mutator_host_client() { return mutator_host_client_; } | 76 MutatorHostClient* mutator_host_client() { return mutator_host_client_; } |
77 const MutatorHostClient* mutator_host_client() const { | 77 const MutatorHostClient* mutator_host_client() const { |
78 return mutator_host_client_; | 78 return mutator_host_client_; |
79 } | 79 } |
80 void SetMutatorHostClient(MutatorHostClient* client); | 80 void SetMutatorHostClient(MutatorHostClient* client); |
81 | 81 |
82 void SetNeedsCommit(); | 82 void SetNeedsPushProperties(); |
83 void SetNeedsRebuildPropertyTrees(); | 83 bool needs_push_properties() const { return needs_push_properties_; } |
84 | 84 |
85 void PushPropertiesTo(AnimationHost* host_impl); | 85 void PushPropertiesTo(AnimationHost* host_impl); |
86 | 86 |
87 void SetSupportsScrollAnimations(bool supports_scroll_animations); | 87 void SetSupportsScrollAnimations(bool supports_scroll_animations); |
88 bool SupportsScrollAnimations() const; | 88 bool SupportsScrollAnimations() const; |
89 bool NeedsAnimateLayers() const; | 89 bool NeedsAnimateLayers() const; |
90 | 90 |
91 bool ActivateAnimations(); | 91 bool ActivateAnimations(); |
92 bool AnimateLayers(base::TimeTicks monotonic_time); | 92 bool AnimateLayers(base::TimeTicks monotonic_time); |
93 bool UpdateAnimationState(bool start_ready_animations, | 93 bool UpdateAnimationState(bool start_ready_animations, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 void DidDeactivateElementAnimations(ElementAnimations* element_animations); | 163 void DidDeactivateElementAnimations(ElementAnimations* element_animations); |
164 | 164 |
165 // Registers the given ElementAnimations as alive. | 165 // Registers the given ElementAnimations as alive. |
166 void RegisterElementAnimations(ElementAnimations* element_animations); | 166 void RegisterElementAnimations(ElementAnimations* element_animations); |
167 // Unregisters the given ElementAnimations as alive. | 167 // Unregisters the given ElementAnimations as alive. |
168 void UnregisterElementAnimations(ElementAnimations* element_animations); | 168 void UnregisterElementAnimations(ElementAnimations* element_animations); |
169 | 169 |
170 const ElementToAnimationsMap& active_element_animations_for_testing() const; | 170 const ElementToAnimationsMap& active_element_animations_for_testing() const; |
171 const ElementToAnimationsMap& all_element_animations_for_testing() const; | 171 const ElementToAnimationsMap& all_element_animations_for_testing() const; |
172 | 172 |
173 bool animation_waiting_for_deletion() const { | |
174 return animation_waiting_for_deletion_; | |
175 } | |
176 void OnAnimationWaitingForDeletion(); | |
177 | |
178 private: | 173 private: |
179 explicit AnimationHost(ThreadInstance thread_instance); | 174 explicit AnimationHost(ThreadInstance thread_instance); |
180 | 175 |
181 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 176 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
182 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 177 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
183 void PushPropertiesToImplThread(AnimationHost* host_impl); | 178 void PushPropertiesToImplThread(AnimationHost* host_impl); |
184 | 179 |
185 void EraseTimeline(scoped_refptr<AnimationTimeline> timeline); | 180 void EraseTimeline(scoped_refptr<AnimationTimeline> timeline); |
186 | 181 |
187 ElementToAnimationsMap element_to_animations_map_; | 182 ElementToAnimationsMap element_to_animations_map_; |
188 ElementToAnimationsMap active_element_to_animations_map_; | 183 ElementToAnimationsMap active_element_to_animations_map_; |
189 | 184 |
190 // A list of all timelines which this host owns. | 185 // A list of all timelines which this host owns. |
191 using IdToTimelineMap = | 186 using IdToTimelineMap = |
192 std::unordered_map<int, scoped_refptr<AnimationTimeline>>; | 187 std::unordered_map<int, scoped_refptr<AnimationTimeline>>; |
193 IdToTimelineMap id_to_timeline_map_; | 188 IdToTimelineMap id_to_timeline_map_; |
194 | 189 |
195 MutatorHostClient* mutator_host_client_; | 190 MutatorHostClient* mutator_host_client_; |
196 | 191 |
197 std::unique_ptr<ScrollOffsetAnimations> scroll_offset_animations_; | 192 std::unique_ptr<ScrollOffsetAnimations> scroll_offset_animations_; |
198 std::unique_ptr<ScrollOffsetAnimationsImpl> scroll_offset_animations_impl_; | 193 std::unique_ptr<ScrollOffsetAnimationsImpl> scroll_offset_animations_impl_; |
199 | 194 |
200 const ThreadInstance thread_instance_; | 195 const ThreadInstance thread_instance_; |
201 | 196 |
202 bool supports_scroll_animations_; | 197 bool supports_scroll_animations_; |
203 bool animation_waiting_for_deletion_; | 198 bool needs_push_properties_; |
204 | 199 |
205 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 200 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
206 }; | 201 }; |
207 | 202 |
208 } // namespace cc | 203 } // namespace cc |
209 | 204 |
210 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 205 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
OLD | NEW |