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/hash_tables.h" | 10 #include "base/containers/hash_tables.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 | 16 |
15 namespace cc { | 17 namespace cc { |
16 | 18 |
17 class AnimationPlayer; | 19 class AnimationPlayer; |
18 class AnimationRegistrar; | 20 class AnimationRegistrar; |
19 class AnimationTimeline; | 21 class AnimationTimeline; |
20 class LayerTreeHost; | 22 class LayerTreeHost; |
21 class LayerTreeMutatorsClient; | 23 class LayerTreeMutatorsClient; |
22 | 24 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); | 61 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); |
60 | 62 |
61 void SetNeedsCommit(); | 63 void SetNeedsCommit(); |
62 | 64 |
63 void PushPropertiesTo(AnimationHost* host_impl); | 65 void PushPropertiesTo(AnimationHost* host_impl); |
64 | 66 |
65 AnimationRegistrar* animation_registrar() const { | 67 AnimationRegistrar* animation_registrar() const { |
66 return animation_registrar_.get(); | 68 return animation_registrar_.get(); |
67 } | 69 } |
68 | 70 |
| 71 void SetSupportsScrollAnimations(bool supports_scroll_animations); |
| 72 bool SupportsScrollAnimations() const; |
| 73 bool NeedsAnimateLayers() const; |
| 74 |
| 75 bool ActivateAnimations(); |
| 76 bool AnimateLayers(base::TimeTicks monotonic_time); |
| 77 bool UpdateAnimationState(bool start_ready_animations, |
| 78 AnimationEventsVector* events); |
| 79 |
| 80 scoped_ptr<AnimationEventsVector> CreateEvents(); |
| 81 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); |
| 82 |
| 83 bool ScrollOffsetAnimationWasInterrupted(int layer_id) const; |
| 84 |
| 85 bool IsAnimatingFilterProperty(int layer_id) const; |
| 86 bool IsAnimatingOpacityProperty(int layer_id) const; |
| 87 bool IsAnimatingTransformProperty(int layer_id) const; |
| 88 |
| 89 bool HasPotentiallyRunningOpacityAnimation(int layer_id) const; |
| 90 bool HasPotentiallyRunningTransformAnimation(int layer_id) const; |
| 91 |
| 92 bool FilterIsAnimatingOnImplOnly(int layer_id) const; |
| 93 bool OpacityIsAnimatingOnImplOnly(int layer_id) const; |
| 94 bool TransformIsAnimatingOnImplOnly(int layer_id) const; |
| 95 |
| 96 bool HasFilterAnimationThatInflatesBounds(int layer_id) const; |
| 97 bool HasTransformAnimationThatInflatesBounds(int layer_id) const; |
| 98 bool HasAnimationThatInflatesBounds(int layer_id) const; |
| 99 |
| 100 bool FilterAnimationBoundsForBox(int layer_id, |
| 101 const gfx::BoxF& box, |
| 102 gfx::BoxF* bounds) const; |
| 103 bool TransformAnimationBoundsForBox(int layer_id, |
| 104 const gfx::BoxF& box, |
| 105 gfx::BoxF* bounds) const; |
| 106 |
| 107 bool HasOnlyTranslationTransforms(int layer_id) const; |
| 108 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
| 109 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
| 110 |
| 111 bool HasAnyAnimation(int layer_id) const; |
| 112 bool HasActiveAnimation(int layer_id) const; |
| 113 |
69 private: | 114 private: |
70 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share | 115 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share |
71 // LayerAnimationController for a given layer at the moment. | 116 // LayerAnimationController for a given layer at the moment. |
72 // Introduce LayersAnimations for the many AnimationPlayers to many Layers | 117 // Introduce LayersAnimations for the many AnimationPlayers to many Layers |
73 // mapping (a CC counterpart for blink::ElementAnimations). | 118 // mapping (a CC counterpart for blink::ElementAnimations). |
74 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; | 119 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; |
75 LayerToPlayerMap layer_to_player_map_; | 120 LayerToPlayerMap layer_to_player_map_; |
76 | 121 |
77 explicit AnimationHost(bool is_impl_instance); | 122 explicit AnimationHost(bool is_impl_instance); |
78 | 123 |
79 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 124 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
80 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 125 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
81 void PushPropertiesToImplThread(AnimationHost* host_impl); | 126 void PushPropertiesToImplThread(AnimationHost* host_impl); |
82 | 127 |
83 void EraseTimelines(AnimationTimelineList::iterator begin, | 128 void EraseTimelines(AnimationTimelineList::iterator begin, |
84 AnimationTimelineList::iterator end); | 129 AnimationTimelineList::iterator end); |
85 | 130 |
86 AnimationTimelineList timelines_; | 131 AnimationTimelineList timelines_; |
87 scoped_ptr<AnimationRegistrar> animation_registrar_; | 132 scoped_ptr<AnimationRegistrar> animation_registrar_; |
88 LayerTreeMutatorsClient* layer_tree_mutators_client_; | 133 LayerTreeMutatorsClient* layer_tree_mutators_client_; |
89 | 134 |
90 const bool is_impl_instance_; | 135 const bool is_impl_instance_; |
91 | 136 |
92 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 137 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
93 }; | 138 }; |
94 | 139 |
95 } // namespace cc | 140 } // namespace cc |
96 | 141 |
97 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 142 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
OLD | NEW |