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