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" |
| 14 #include "cc/animation/animation_events.h" |
13 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
14 #include "cc/trees/mutator_host_client.h" | 16 #include "cc/trees/mutator_host_client.h" |
15 | 17 |
16 namespace cc { | 18 namespace cc { |
17 | 19 |
18 class AnimationPlayer; | 20 class AnimationPlayer; |
19 class AnimationRegistrar; | 21 class AnimationRegistrar; |
20 class AnimationTimeline; | 22 class AnimationTimeline; |
21 class ElementAnimations; | 23 class ElementAnimations; |
22 class LayerAnimationController; | 24 class LayerAnimationController; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void SetMutatorHostClient(MutatorHostClient* client); | 68 void SetMutatorHostClient(MutatorHostClient* client); |
67 | 69 |
68 void SetNeedsCommit(); | 70 void SetNeedsCommit(); |
69 | 71 |
70 void PushPropertiesTo(AnimationHost* host_impl); | 72 void PushPropertiesTo(AnimationHost* host_impl); |
71 | 73 |
72 AnimationRegistrar* animation_registrar() const { | 74 AnimationRegistrar* animation_registrar() const { |
73 return animation_registrar_.get(); | 75 return animation_registrar_.get(); |
74 } | 76 } |
75 | 77 |
| 78 void SetSupportsScrollAnimations(bool supports_scroll_animations); |
| 79 bool SupportsScrollAnimations() const; |
| 80 bool NeedsAnimateLayers() const; |
| 81 |
| 82 bool ActivateAnimations(); |
| 83 bool AnimateLayers(base::TimeTicks monotonic_time); |
| 84 bool UpdateAnimationState(bool start_ready_animations, |
| 85 AnimationEventsVector* events); |
| 86 |
| 87 scoped_ptr<AnimationEventsVector> CreateEvents(); |
| 88 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); |
| 89 |
| 90 bool ScrollOffsetAnimationWasInterrupted(int layer_id) const; |
| 91 |
| 92 bool IsAnimatingFilterProperty(int layer_id) const; |
| 93 bool IsAnimatingOpacityProperty(int layer_id) const; |
| 94 bool IsAnimatingTransformProperty(int layer_id) const; |
| 95 |
| 96 bool HasPotentiallyRunningOpacityAnimation(int layer_id) const; |
| 97 bool HasPotentiallyRunningTransformAnimation(int layer_id) const; |
| 98 |
| 99 bool FilterIsAnimatingOnImplOnly(int layer_id) const; |
| 100 bool OpacityIsAnimatingOnImplOnly(int layer_id) const; |
| 101 bool TransformIsAnimatingOnImplOnly(int layer_id) const; |
| 102 |
| 103 bool HasFilterAnimationThatInflatesBounds(int layer_id) const; |
| 104 bool HasTransformAnimationThatInflatesBounds(int layer_id) const; |
| 105 bool HasAnimationThatInflatesBounds(int layer_id) const; |
| 106 |
| 107 bool FilterAnimationBoundsForBox(int layer_id, |
| 108 const gfx::BoxF& box, |
| 109 gfx::BoxF* bounds) const; |
| 110 bool TransformAnimationBoundsForBox(int layer_id, |
| 111 const gfx::BoxF& box, |
| 112 gfx::BoxF* bounds) const; |
| 113 |
| 114 bool HasOnlyTranslationTransforms(int layer_id) const; |
| 115 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
| 116 |
| 117 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
| 118 bool AnimationStartScale(int layer_id, float* start_scale) const; |
| 119 |
| 120 bool HasAnyAnimation(int layer_id) const; |
| 121 bool HasActiveAnimation(int layer_id) const; |
| 122 |
76 private: | 123 private: |
77 explicit AnimationHost(ThreadInstance thread_instance); | 124 explicit AnimationHost(ThreadInstance thread_instance); |
78 | 125 |
79 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 126 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
80 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 127 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
81 void PushPropertiesToImplThread(AnimationHost* host_impl); | 128 void PushPropertiesToImplThread(AnimationHost* host_impl); |
82 | 129 |
83 void EraseTimelines(AnimationTimelineList::iterator begin, | 130 void EraseTimelines(AnimationTimelineList::iterator begin, |
84 AnimationTimelineList::iterator end); | 131 AnimationTimelineList::iterator end); |
85 | 132 |
86 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object | 133 // TODO(loyso): For now AnimationPlayers share LayerAnimationController object |
87 // 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 |
88 // contain many Layers. | 135 // contain many Layers. |
89 typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>> | 136 typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>> |
90 LayerToElementAnimationsMap; | 137 LayerToElementAnimationsMap; |
91 LayerToElementAnimationsMap layer_to_element_animations_map_; | 138 LayerToElementAnimationsMap layer_to_element_animations_map_; |
92 | 139 |
93 AnimationTimelineList timelines_; | 140 AnimationTimelineList timelines_; |
94 scoped_ptr<AnimationRegistrar> animation_registrar_; | 141 scoped_ptr<AnimationRegistrar> animation_registrar_; |
95 MutatorHostClient* mutator_host_client_; | 142 MutatorHostClient* mutator_host_client_; |
96 | 143 |
97 const ThreadInstance thread_instance_; | 144 const ThreadInstance thread_instance_; |
98 | 145 |
99 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 146 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
100 }; | 147 }; |
101 | 148 |
102 } // namespace cc | 149 } // namespace cc |
103 | 150 |
104 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 151 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
OLD | NEW |