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 26 matching lines...) Expand all Loading... |
49 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); | 51 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); |
50 | 52 |
51 void SetNeedsCommit(); | 53 void SetNeedsCommit(); |
52 | 54 |
53 void PushPropertiesTo(AnimationHost* host_impl); | 55 void PushPropertiesTo(AnimationHost* host_impl); |
54 | 56 |
55 AnimationRegistrar* animation_registrar() const { | 57 AnimationRegistrar* animation_registrar() const { |
56 return animation_registrar_.get(); | 58 return animation_registrar_.get(); |
57 } | 59 } |
58 | 60 |
| 61 void SetSupportsScrollAnimations(bool supports_scroll_animations); |
| 62 bool GetSupportsScrollAnimations() const; |
| 63 bool NeedsAnimateLayers() const; |
| 64 |
| 65 bool ActivateAnimations(); |
| 66 bool AnimateLayers(base::TimeTicks monotonic_time); |
| 67 bool UpdateAnimationState(bool start_ready_animations, |
| 68 AnimationEventsVector* events); |
| 69 |
| 70 scoped_ptr<AnimationEventsVector> CreateEvents(); |
| 71 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); |
| 72 |
| 73 bool IsAnimatingFilterProperty(int layer_id) const; |
| 74 bool IsAnimatingOpacityProperty(int layer_id) const; |
| 75 bool IsAnimatingTransformProperty(int layer_id) const; |
| 76 |
| 77 bool FilterIsAnimatingOnImplOnly(int layer_id) const; |
| 78 bool OpacityIsAnimatingOnImplOnly(int layer_id) const; |
| 79 bool TransformIsAnimatingOnImplOnly(int layer_id) const; |
| 80 |
| 81 bool HasFilterAnimationThatInflatesBounds(int layer_id) const; |
| 82 bool HasTransformAnimationThatInflatesBounds(int layer_id) const; |
| 83 bool HasAnimationThatInflatesBounds(int layer_id) const; |
| 84 |
| 85 bool FilterAnimationBoundsForBox(int layer_id, |
| 86 const gfx::BoxF& box, |
| 87 gfx::BoxF* bounds) const; |
| 88 bool TransformAnimationBoundsForBox(int layer_id, |
| 89 const gfx::BoxF& box, |
| 90 gfx::BoxF* bounds) const; |
| 91 |
| 92 bool HasOnlyTranslationTransforms(int layer_id) const; |
| 93 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
| 94 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
| 95 |
| 96 bool HasAnyAnimation(int layer_id) const; |
| 97 bool HasActiveAnimation(int layer_id) const; |
| 98 |
59 private: | 99 private: |
60 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share | 100 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share |
61 // LayerAnimationController for a given layer at the moment. | 101 // LayerAnimationController for a given layer at the moment. |
62 // Introduce LayersAnimations for the many AnimationPlayers to many Layers | 102 // Introduce LayersAnimations for the many AnimationPlayers to many Layers |
63 // mapping (a CC counterpart for blink::ElementAnimations). | 103 // mapping (a CC counterpart for blink::ElementAnimations). |
64 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; | 104 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; |
65 LayerToPlayerMap layer_to_player_map_; | 105 LayerToPlayerMap layer_to_player_map_; |
66 | 106 |
67 explicit AnimationHost(bool is_impl_instance); | 107 explicit AnimationHost(bool is_impl_instance); |
68 | 108 |
69 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 109 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
70 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 110 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
71 void PushPropertiesToImplThread(AnimationHost* host_impl); | 111 void PushPropertiesToImplThread(AnimationHost* host_impl); |
72 | 112 |
73 void EraseTimelines(AnimationTimelineList::iterator begin, | 113 void EraseTimelines(AnimationTimelineList::iterator begin, |
74 AnimationTimelineList::iterator end); | 114 AnimationTimelineList::iterator end); |
75 | 115 |
76 AnimationTimelineList timelines_; | 116 AnimationTimelineList timelines_; |
77 scoped_ptr<AnimationRegistrar> animation_registrar_; | 117 scoped_ptr<AnimationRegistrar> animation_registrar_; |
78 LayerTreeMutatorsClient* layer_tree_mutators_client_; | 118 LayerTreeMutatorsClient* layer_tree_mutators_client_; |
79 | 119 |
80 const bool is_impl_instance_; | 120 const bool is_impl_instance_; |
81 | 121 |
82 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 122 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
83 }; | 123 }; |
84 | 124 |
85 } // namespace cc | 125 } // namespace cc |
86 | 126 |
87 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 127 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
OLD | NEW |