| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // There is just one AnimationHost for LayerTreeHost on main renderer thread | 33 // There is just one AnimationHost for LayerTreeHost on main renderer thread |
| 34 // and just one AnimationHost for LayerTreeHostImpl on impl thread. | 34 // and just one AnimationHost for LayerTreeHostImpl on impl thread. |
| 35 // We synchronize them during the commit process in a one-way data flow process | 35 // We synchronize them during the commit process in a one-way data flow process |
| 36 // (PushPropertiesTo). | 36 // (PushPropertiesTo). |
| 37 // An AnimationHost talks to its correspondent LayerTreeHost via | 37 // An AnimationHost talks to its correspondent LayerTreeHost via |
| 38 // LayerTreeMutatorsClient interface. | 38 // LayerTreeMutatorsClient interface. |
| 39 // AnimationHost has it's own instance of AnimationRegistrar, | 39 // AnimationHost has it's own instance of AnimationRegistrar, |
| 40 // we want to merge AnimationRegistrar into AnimationHost. | 40 // we want to merge AnimationRegistrar into AnimationHost. |
| 41 class CC_EXPORT AnimationHost { | 41 class CC_EXPORT AnimationHost { |
| 42 public: | 42 public: |
| 43 static scoped_ptr<AnimationHost> Create(ThreadInstance thread_instance); | 43 static scoped_ptr<AnimationHost> Create(); |
| 44 virtual ~AnimationHost(); | 44 virtual ~AnimationHost(); |
| 45 | 45 |
| 46 void AddAnimationTimeline(scoped_refptr<AnimationTimeline> timeline); | 46 void AddAnimationTimeline(scoped_refptr<AnimationTimeline> timeline); |
| 47 void RemoveAnimationTimeline(scoped_refptr<AnimationTimeline> timeline); | 47 void RemoveAnimationTimeline(scoped_refptr<AnimationTimeline> timeline); |
| 48 AnimationTimeline* GetTimelineById(int timeline_id) const; | 48 AnimationTimeline* GetTimelineById(int timeline_id) const; |
| 49 | 49 |
| 50 void ClearTimelines(); | 50 void ClearTimelines(); |
| 51 | 51 |
| 52 void RegisterLayer(int layer_id, LayerTreeType tree_type); | 52 void RegisterLayer(int layer_id, LayerTreeType tree_type); |
| 53 void UnregisterLayer(int layer_id, LayerTreeType tree_type); | 53 void UnregisterLayer(int layer_id, LayerTreeType tree_type); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool HasOnlyTranslationTransforms(int layer_id) const; | 114 bool HasOnlyTranslationTransforms(int layer_id) const; |
| 115 bool AnimationsPreserveAxisAlignment(int layer_id) const; | 115 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
| 116 | 116 |
| 117 bool MaximumTargetScale(int layer_id, float* max_scale) const; | 117 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
| 118 bool AnimationStartScale(int layer_id, float* start_scale) const; | 118 bool AnimationStartScale(int layer_id, float* start_scale) const; |
| 119 | 119 |
| 120 bool HasAnyAnimation(int layer_id) const; | 120 bool HasAnyAnimation(int layer_id) const; |
| 121 bool HasActiveAnimation(int layer_id) const; | 121 bool HasActiveAnimation(int layer_id) const; |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 explicit AnimationHost(ThreadInstance thread_instance); | 124 AnimationHost(); |
| 125 | 125 |
| 126 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 126 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
| 127 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 127 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
| 128 void PushPropertiesToImplThread(AnimationHost* host_impl); | 128 void PushPropertiesToImplThread(AnimationHost* host_impl); |
| 129 | 129 |
| 130 void EraseTimelines(AnimationTimelineList::iterator begin, | 130 void EraseTimelines(AnimationTimelineList::iterator begin, |
| 131 AnimationTimelineList::iterator end); | 131 AnimationTimelineList::iterator end); |
| 132 | 132 |
| 133 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object | 133 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object |
| 134 // if they are attached to the same element(layer). Note that Element can | 134 // if they are attached to the same element(layer). Note that Element can |
| 135 // contain many Layers. | 135 // contain many Layers. |
| 136 typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>> | 136 typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>> |
| 137 LayerToElementAnimationsMap; | 137 LayerToElementAnimationsMap; |
| 138 LayerToElementAnimationsMap layer_to_element_animations_map_; | 138 LayerToElementAnimationsMap layer_to_element_animations_map_; |
| 139 | 139 |
| 140 AnimationTimelineList timelines_; | 140 AnimationTimelineList timelines_; |
| 141 scoped_ptr<AnimationRegistrar> animation_registrar_; | 141 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 142 MutatorHostClient* mutator_host_client_; | 142 MutatorHostClient* mutator_host_client_; |
| 143 | 143 |
| 144 const ThreadInstance thread_instance_; | |
| 145 | |
| 146 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 144 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
| 147 }; | 145 }; |
| 148 | 146 |
| 149 } // namespace cc | 147 } // namespace cc |
| 150 | 148 |
| 151 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 149 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
| OLD | NEW |