| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "cc/animation/animation_events.h" | 14 #include "cc/animation/animation_events.h" |
| 15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
| 16 #include "cc/trees/mutator_host_client.h" | 16 #include "cc/trees/mutator_host_client.h" |
| 17 | 17 |
| 18 namespace gfx { |
| 19 class ScrollOffset; |
| 20 } |
| 21 |
| 18 namespace cc { | 22 namespace cc { |
| 19 | 23 |
| 20 class AnimationPlayer; | 24 class AnimationPlayer; |
| 21 class AnimationRegistrar; | 25 class AnimationRegistrar; |
| 22 class AnimationTimeline; | 26 class AnimationTimeline; |
| 23 class ElementAnimations; | 27 class ElementAnimations; |
| 24 class LayerAnimationController; | 28 class LayerAnimationController; |
| 25 class LayerTreeHost; | 29 class LayerTreeHost; |
| 26 | 30 |
| 27 enum class ThreadInstance { MAIN, IMPL }; | 31 enum class ThreadInstance { MAIN, IMPL }; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 117 |
| 114 bool HasOnlyTranslationTransforms(int layer_id) const; | 118 bool HasOnlyTranslationTransforms(int layer_id) const; |
| 115 bool AnimationsPreserveAxisAlignment(int layer_id) const; | 119 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
| 116 | 120 |
| 117 bool MaximumTargetScale(int layer_id, float* max_scale) const; | 121 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
| 118 bool AnimationStartScale(int layer_id, float* start_scale) const; | 122 bool AnimationStartScale(int layer_id, float* start_scale) const; |
| 119 | 123 |
| 120 bool HasAnyAnimation(int layer_id) const; | 124 bool HasAnyAnimation(int layer_id) const; |
| 121 bool HasActiveAnimation(int layer_id) const; | 125 bool HasActiveAnimation(int layer_id) const; |
| 122 | 126 |
| 127 void ImplOnlyScrollAnimationCreate(int layer_id, |
| 128 const gfx::ScrollOffset& target_offset, |
| 129 const gfx::ScrollOffset& current_offset); |
| 130 bool ImplOnlyScrollAnimationUpdateTarget( |
| 131 int layer_id, |
| 132 const gfx::Vector2dF& scroll_delta, |
| 133 const gfx::ScrollOffset& max_scroll_offset, |
| 134 base::TimeTicks frame_monotonic_time); |
| 135 |
| 123 private: | 136 private: |
| 124 explicit AnimationHost(ThreadInstance thread_instance); | 137 explicit AnimationHost(ThreadInstance thread_instance); |
| 125 | 138 |
| 126 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 139 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
| 127 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 140 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
| 128 void PushPropertiesToImplThread(AnimationHost* host_impl); | 141 void PushPropertiesToImplThread(AnimationHost* host_impl); |
| 129 | 142 |
| 130 void EraseTimelines(AnimationTimelineList::iterator begin, | 143 void EraseTimelines(AnimationTimelineList::iterator begin, |
| 131 AnimationTimelineList::iterator end); | 144 AnimationTimelineList::iterator end); |
| 132 | 145 |
| 133 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object | 146 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object |
| 134 // if they are attached to the same element(layer). Note that Element can | 147 // if they are attached to the same element(layer). Note that Element can |
| 135 // contain many Layers. | 148 // contain many Layers. |
| 136 typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>> | 149 typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>> |
| 137 LayerToElementAnimationsMap; | 150 LayerToElementAnimationsMap; |
| 138 LayerToElementAnimationsMap layer_to_element_animations_map_; | 151 LayerToElementAnimationsMap layer_to_element_animations_map_; |
| 139 | 152 |
| 140 AnimationTimelineList timelines_; | 153 AnimationTimelineList timelines_; |
| 141 scoped_ptr<AnimationRegistrar> animation_registrar_; | 154 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 142 MutatorHostClient* mutator_host_client_; | 155 MutatorHostClient* mutator_host_client_; |
| 143 | 156 |
| 157 class ScrollOffsetAnimations; |
| 158 scoped_ptr<ScrollOffsetAnimations> scroll_offset_animations_; |
| 159 |
| 144 const ThreadInstance thread_instance_; | 160 const ThreadInstance thread_instance_; |
| 145 | 161 |
| 146 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 162 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
| 147 }; | 163 }; |
| 148 | 164 |
| 149 } // namespace cc | 165 } // namespace cc |
| 150 | 166 |
| 151 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 167 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
| OLD | NEW |