| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 AnimationTimeline* GetTimelineById(int timeline_id) const; | 54 AnimationTimeline* GetTimelineById(int timeline_id) const; |
| 55 | 55 |
| 56 void ClearTimelines(); | 56 void ClearTimelines(); |
| 57 | 57 |
| 58 void RegisterLayer(int layer_id, LayerTreeType tree_type); | 58 void RegisterLayer(int layer_id, LayerTreeType tree_type); |
| 59 void UnregisterLayer(int layer_id, LayerTreeType tree_type); | 59 void UnregisterLayer(int layer_id, LayerTreeType tree_type); |
| 60 | 60 |
| 61 void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player); | 61 void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player); |
| 62 void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player); | 62 void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player); |
| 63 | 63 |
| 64 ElementAnimations* GetElementAnimationsForLayerId(int layer_id) const; | 64 scoped_refptr<ElementAnimations> GetElementAnimationsForLayerId( |
| 65 int layer_id) const; |
| 65 | 66 |
| 66 // TODO(loyso): Get rid of LayerAnimationController. | 67 // TODO(loyso): Get rid of LayerAnimationController. |
| 67 LayerAnimationController* GetControllerForLayerId(int layer_id) const; | 68 LayerAnimationController* GetControllerForLayerId(int layer_id) const; |
| 68 | 69 |
| 69 // Parent LayerTreeHost or LayerTreeHostImpl. | 70 // Parent LayerTreeHost or LayerTreeHostImpl. |
| 70 MutatorHostClient* mutator_host_client() { return mutator_host_client_; } | 71 MutatorHostClient* mutator_host_client() { return mutator_host_client_; } |
| 71 const MutatorHostClient* mutator_host_client() const { | 72 const MutatorHostClient* mutator_host_client() const { |
| 72 return mutator_host_client_; | 73 return mutator_host_client_; |
| 73 } | 74 } |
| 74 void SetMutatorHostClient(MutatorHostClient* client); | 75 void SetMutatorHostClient(MutatorHostClient* client); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 173 |
| 173 private: | 174 private: |
| 174 explicit AnimationHost(ThreadInstance thread_instance); | 175 explicit AnimationHost(ThreadInstance thread_instance); |
| 175 | 176 |
| 176 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 177 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
| 177 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 178 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
| 178 void PushPropertiesToImplThread(AnimationHost* host_impl); | 179 void PushPropertiesToImplThread(AnimationHost* host_impl); |
| 179 | 180 |
| 180 void EraseTimeline(scoped_refptr<AnimationTimeline> timeline); | 181 void EraseTimeline(scoped_refptr<AnimationTimeline> timeline); |
| 181 | 182 |
| 182 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object | 183 // AnimationPlayers share ElementAnimations object if they are attached to the |
| 183 // if they are attached to the same element(layer). Note that Element can | 184 // same element(layer). Note that Element can contain many Layers. |
| 184 // contain many Layers. | |
| 185 using LayerToElementAnimationsMap = | 185 using LayerToElementAnimationsMap = |
| 186 std::unordered_map<int, std::unique_ptr<ElementAnimations>>; | 186 std::unordered_map<int, scoped_refptr<ElementAnimations>>; |
| 187 LayerToElementAnimationsMap layer_to_element_animations_map_; | 187 LayerToElementAnimationsMap layer_to_element_animations_map_; |
| 188 | 188 |
| 189 // A list of all timelines which this host owns. | 189 // A list of all timelines which this host owns. |
| 190 using IdToTimelineMap = | 190 using IdToTimelineMap = |
| 191 std::unordered_map<int, scoped_refptr<AnimationTimeline>>; | 191 std::unordered_map<int, scoped_refptr<AnimationTimeline>>; |
| 192 IdToTimelineMap id_to_timeline_map_; | 192 IdToTimelineMap id_to_timeline_map_; |
| 193 | 193 |
| 194 AnimationControllerMap active_animation_controllers_; | 194 AnimationControllerMap active_animation_controllers_; |
| 195 AnimationControllerMap all_animation_controllers_; | 195 AnimationControllerMap all_animation_controllers_; |
| 196 | 196 |
| 197 MutatorHostClient* mutator_host_client_; | 197 MutatorHostClient* mutator_host_client_; |
| 198 | 198 |
| 199 class ScrollOffsetAnimations; | 199 class ScrollOffsetAnimations; |
| 200 std::unique_ptr<ScrollOffsetAnimations> scroll_offset_animations_; | 200 std::unique_ptr<ScrollOffsetAnimations> scroll_offset_animations_; |
| 201 | 201 |
| 202 const ThreadInstance thread_instance_; | 202 const ThreadInstance thread_instance_; |
| 203 | 203 |
| 204 bool supports_scroll_animations_; | 204 bool supports_scroll_animations_; |
| 205 | 205 |
| 206 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 206 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 } // namespace cc | 209 } // namespace cc |
| 210 | 210 |
| 211 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 211 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
| OLD | NEW |