Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Side by Side Diff: cc/animation/layer_animation_controller.h

Issue 231133002: CC::Animations should use TimeTicks & TimeDelta to represent time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding Animation related changes and unittests Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_LAYER_ANIMATION_CONTROLLER_H_ 5 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 22 matching lines...) Expand all
33 class LayerAnimationValueProvider; 33 class LayerAnimationValueProvider;
34 34
35 class CC_EXPORT LayerAnimationController 35 class CC_EXPORT LayerAnimationController
36 : public base::RefCounted<LayerAnimationController> { 36 : public base::RefCounted<LayerAnimationController> {
37 public: 37 public:
38 static scoped_refptr<LayerAnimationController> Create(int id); 38 static scoped_refptr<LayerAnimationController> Create(int id);
39 39
40 int id() const { return id_; } 40 int id() const { return id_; }
41 41
42 void AddAnimation(scoped_ptr<Animation> animation); 42 void AddAnimation(scoped_ptr<Animation> animation);
43 void PauseAnimation(int animation_id, double time_offset); 43 void PauseAnimation(int animation_id, base::TimeDelta time_offset);
44 void RemoveAnimation(int animation_id); 44 void RemoveAnimation(int animation_id);
45 void RemoveAnimation(int animation_id, 45 void RemoveAnimation(int animation_id,
46 Animation::TargetProperty target_property); 46 Animation::TargetProperty target_property);
47 void AbortAnimations(Animation::TargetProperty target_property); 47 void AbortAnimations(Animation::TargetProperty target_property);
48 48
49 // Ensures that the list of active animations on the main thread and the impl 49 // Ensures that the list of active animations on the main thread and the impl
50 // thread are kept in sync. This function does not take ownership of the impl 50 // thread are kept in sync. This function does not take ownership of the impl
51 // thread controller. This method is virtual for testing. 51 // thread controller. This method is virtual for testing.
52 virtual void PushAnimationUpdatesTo( 52 virtual void PushAnimationUpdatesTo(
53 LayerAnimationController* controller_impl); 53 LayerAnimationController* controller_impl);
54 54
55 void Animate(double monotonic_time); 55 void Animate(base::TimeTicks monotonic_time);
56 void AccumulatePropertyUpdates(double monotonic_time, 56 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time,
57 AnimationEventsVector* events); 57 AnimationEventsVector* events);
58 58
59 void UpdateState(bool start_ready_animations, 59 void UpdateState(bool start_ready_animations,
60 AnimationEventsVector* events); 60 AnimationEventsVector* events);
61 61
62 // Returns the active animation in the given group, animating the given 62 // Returns the active animation in the given group, animating the given
63 // property, if such an animation exists. 63 // property, if such an animation exists.
64 Animation* GetAnimation(int group_id, 64 Animation* GetAnimation(int group_id,
65 Animation::TargetProperty target_property) const; 65 Animation::TargetProperty target_property) const;
66 66
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 private: 136 private:
137 typedef base::hash_set<int> TargetProperties; 137 typedef base::hash_set<int> TargetProperties;
138 138
139 void PushNewAnimationsToImplThread( 139 void PushNewAnimationsToImplThread(
140 LayerAnimationController* controller_impl) const; 140 LayerAnimationController* controller_impl) const;
141 void RemoveAnimationsCompletedOnMainThread( 141 void RemoveAnimationsCompletedOnMainThread(
142 LayerAnimationController* controller_impl) const; 142 LayerAnimationController* controller_impl) const;
143 void PushPropertiesToImplThread( 143 void PushPropertiesToImplThread(
144 LayerAnimationController* controller_impl) const; 144 LayerAnimationController* controller_impl) const;
145 145
146 void StartAnimations(double monotonic_time); 146 void StartAnimations(base::TimeTicks monotonic_time);
147 void PromoteStartedAnimations(double monotonic_time, 147 void PromoteStartedAnimations(base::TimeTicks monotonic_time,
148 AnimationEventsVector* events); 148 AnimationEventsVector* events);
149 void MarkFinishedAnimations(double monotonic_time); 149 void MarkFinishedAnimations(base::TimeTicks monotonic_time);
150 void MarkAnimationsForDeletion(double monotonic_time, 150 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time,
151 AnimationEventsVector* events); 151 AnimationEventsVector* events);
152 void PurgeAnimationsMarkedForDeletion(); 152 void PurgeAnimationsMarkedForDeletion();
153 153
154 void TickAnimations(double monotonic_time); 154 void TickAnimations(base::TimeTicks monotonic_time);
155 155
156 enum UpdateActivationType { 156 enum UpdateActivationType {
157 NormalActivation, 157 NormalActivation,
158 ForceActivation 158 ForceActivation
159 }; 159 };
160 void UpdateActivation(UpdateActivationType type); 160 void UpdateActivation(UpdateActivationType type);
161 161
162 void NotifyObserversOpacityAnimated(float opacity); 162 void NotifyObserversOpacityAnimated(float opacity);
163 void NotifyObserversTransformAnimated(const gfx::Transform& transform); 163 void NotifyObserversTransformAnimated(const gfx::Transform& transform);
164 void NotifyObserversFilterAnimated(const FilterOperations& filter); 164 void NotifyObserversFilterAnimated(const FilterOperations& filter);
165 void NotifyObserversScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset); 165 void NotifyObserversScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset);
166 166
167 void NotifyObserversAnimationWaitingForDeletion(); 167 void NotifyObserversAnimationWaitingForDeletion();
168 168
169 bool HasValueObserver(); 169 bool HasValueObserver();
170 bool HasActiveValueObserver(); 170 bool HasActiveValueObserver();
171 171
172 AnimationRegistrar* registrar_; 172 AnimationRegistrar* registrar_;
173 int id_; 173 int id_;
174 ScopedPtrVector<Animation> active_animations_; 174 ScopedPtrVector<Animation> active_animations_;
175 175
176 // This is used to ensure that we don't spam the registrar. 176 // This is used to ensure that we don't spam the registrar.
177 bool is_active_; 177 bool is_active_;
178 178
179 double last_tick_time_; 179 base::TimeTicks last_tick_time_;
180 180
181 ObserverList<LayerAnimationValueObserver> value_observers_; 181 ObserverList<LayerAnimationValueObserver> value_observers_;
182 ObserverList<LayerAnimationEventObserver> event_observers_; 182 ObserverList<LayerAnimationEventObserver> event_observers_;
183 183
184 LayerAnimationValueProvider* value_provider_; 184 LayerAnimationValueProvider* value_provider_;
185 185
186 AnimationDelegate* layer_animation_delegate_; 186 AnimationDelegate* layer_animation_delegate_;
187 187
188 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); 188 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
189 }; 189 };
190 190
191 } // namespace cc 191 } // namespace cc
192 192
193 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 193 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698