| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const MutatorHostClient* mutator_host_client() const { | 70 const MutatorHostClient* mutator_host_client() const { |
| 71 return mutator_host_client_; | 71 return mutator_host_client_; |
| 72 } | 72 } |
| 73 void SetMutatorHostClient(MutatorHostClient* client); | 73 void SetMutatorHostClient(MutatorHostClient* client); |
| 74 | 74 |
| 75 void SetNeedsCommit(); | 75 void SetNeedsCommit(); |
| 76 void SetNeedsRebuildPropertyTrees(); | 76 void SetNeedsRebuildPropertyTrees(); |
| 77 | 77 |
| 78 void PushPropertiesTo(AnimationHost* host_impl); | 78 void PushPropertiesTo(AnimationHost* host_impl); |
| 79 | 79 |
| 80 AnimationRegistrar* animation_registrar() const { | |
| 81 return animation_registrar_.get(); | |
| 82 } | |
| 83 | |
| 84 void SetSupportsScrollAnimations(bool supports_scroll_animations); | 80 void SetSupportsScrollAnimations(bool supports_scroll_animations); |
| 85 bool SupportsScrollAnimations() const; | 81 bool SupportsScrollAnimations() const; |
| 86 bool NeedsAnimateLayers() const; | 82 bool NeedsAnimateLayers() const; |
| 87 | 83 |
| 88 bool ActivateAnimations(); | 84 bool ActivateAnimations(); |
| 89 bool AnimateLayers(base::TimeTicks monotonic_time); | 85 bool AnimateLayers(base::TimeTicks monotonic_time); |
| 90 bool UpdateAnimationState(bool start_ready_animations, | 86 bool UpdateAnimationState(bool start_ready_animations, |
| 91 AnimationEvents* events); | 87 AnimationEvents* events); |
| 92 | 88 |
| 93 std::unique_ptr<AnimationEvents> CreateEvents(); | 89 std::unique_ptr<AnimationEvents> CreateEvents(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const gfx::ScrollOffset& target_offset, | 140 const gfx::ScrollOffset& target_offset, |
| 145 const gfx::ScrollOffset& current_offset); | 141 const gfx::ScrollOffset& current_offset); |
| 146 bool ImplOnlyScrollAnimationUpdateTarget( | 142 bool ImplOnlyScrollAnimationUpdateTarget( |
| 147 int layer_id, | 143 int layer_id, |
| 148 const gfx::Vector2dF& scroll_delta, | 144 const gfx::Vector2dF& scroll_delta, |
| 149 const gfx::ScrollOffset& max_scroll_offset, | 145 const gfx::ScrollOffset& max_scroll_offset, |
| 150 base::TimeTicks frame_monotonic_time); | 146 base::TimeTicks frame_monotonic_time); |
| 151 | 147 |
| 152 void ScrollAnimationAbort(bool needs_completion); | 148 void ScrollAnimationAbort(bool needs_completion); |
| 153 | 149 |
| 150 // If an animation has been registered for the given id, return it. Otherwise |
| 151 // creates a new one and returns a scoped_refptr to it. |
| 152 scoped_refptr<LayerAnimationController> GetAnimationControllerForId(int id); |
| 153 |
| 154 void SetAnimationRegistrarFor( |
| 155 scoped_refptr<LayerAnimationController> controller); |
| 156 void ResetAnimationRegistrarFor( |
| 157 scoped_refptr<LayerAnimationController> controller); |
| 158 |
| 159 // Registers the given controller as alive. |
| 160 void RegisterAnimationController(LayerAnimationController* controller); |
| 161 // Unregisters the given controller as alive. |
| 162 void UnregisterAnimationController(LayerAnimationController* controller); |
| 163 |
| 164 using AnimationControllerMap = |
| 165 std::unordered_map<int, LayerAnimationController*>; |
| 166 const AnimationControllerMap& active_animation_controllers_for_testing() |
| 167 const; |
| 168 const AnimationControllerMap& all_animation_controllers_for_testing() const; |
| 169 |
| 154 private: | 170 private: |
| 155 explicit AnimationHost(ThreadInstance thread_instance); | 171 explicit AnimationHost(ThreadInstance thread_instance); |
| 156 | 172 |
| 157 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 173 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
| 158 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 174 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
| 159 void PushPropertiesToImplThread(AnimationHost* host_impl); | 175 void PushPropertiesToImplThread(AnimationHost* host_impl); |
| 160 | 176 |
| 161 void EraseTimeline(scoped_refptr<AnimationTimeline> timeline); | 177 void EraseTimeline(scoped_refptr<AnimationTimeline> timeline); |
| 162 | 178 |
| 163 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object | 179 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object |
| (...skipping 15 matching lines...) Expand all Loading... |
| 179 std::unique_ptr<ScrollOffsetAnimations> scroll_offset_animations_; | 195 std::unique_ptr<ScrollOffsetAnimations> scroll_offset_animations_; |
| 180 | 196 |
| 181 const ThreadInstance thread_instance_; | 197 const ThreadInstance thread_instance_; |
| 182 | 198 |
| 183 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 199 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
| 184 }; | 200 }; |
| 185 | 201 |
| 186 } // namespace cc | 202 } // namespace cc |
| 187 | 203 |
| 188 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 204 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
| OLD | NEW |