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

Side by Side Diff: ui/gfx/compositor/layer_animator.h

Issue 9320018: Revert 120092 - Reland 120074 -- Disable animations during aura tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/compositor/layer_animation_observer.cc ('k') | ui/gfx/compositor/layer_animator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ 5 #ifndef UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_
6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ 6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 class Animation; 26 class Animation;
27 class Layer; 27 class Layer;
28 class LayerAnimationSequence; 28 class LayerAnimationSequence;
29 class LayerAnimationDelegate; 29 class LayerAnimationDelegate;
30 class LayerAnimationObserver; 30 class LayerAnimationObserver;
31 class ScopedLayerAnimationSettings; 31 class ScopedLayerAnimationSettings;
32 class Transform; 32 class Transform;
33 33
34 // When a property of layer needs to be changed it is set by way of 34 // When a property of layer needs to be changed it is set by way of
35 // LayerAnimator. This enables LayerAnimator to animate property changes. 35 // LayerAnimator. This enables LayerAnimator to animate property changes.
36 // NB: during many tests, set_disable_animations_for_test is used and causes
37 // all animations to complete immediately.
38 class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement { 36 class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
39 public: 37 public:
40 enum PreemptionStrategy { 38 enum PreemptionStrategy {
41 IMMEDIATELY_SET_NEW_TARGET, 39 IMMEDIATELY_SET_NEW_TARGET,
42 IMMEDIATELY_ANIMATE_TO_NEW_TARGET, 40 IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
43 ENQUEUE_NEW_ANIMATION, 41 ENQUEUE_NEW_ANIMATION,
44 REPLACE_QUEUED_ANIMATIONS, 42 REPLACE_QUEUED_ANIMATIONS,
45 BLEND_WITH_CURRENT_ANIMATION 43 BLEND_WITH_CURRENT_ANIMATION
46 }; 44 };
47 45
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 101
104 // Stops animating the given property. No effect if there is no running 102 // Stops animating the given property. No effect if there is no running
105 // animation for the given property. Skips to the final state of the 103 // animation for the given property. Skips to the final state of the
106 // animation. 104 // animation.
107 void StopAnimatingProperty( 105 void StopAnimatingProperty(
108 LayerAnimationElement::AnimatableProperty property); 106 LayerAnimationElement::AnimatableProperty property);
109 107
110 // Stops all animation and clears any queued animations. 108 // Stops all animation and clears any queued animations.
111 void StopAnimating(); 109 void StopAnimating();
112 110
111 // For testing purposes only.
112 void set_disable_timer_for_test(bool enabled) {
113 disable_timer_for_test_ = enabled;
114 }
115 base::TimeTicks get_last_step_time_for_test() { return last_step_time_; }
116
113 // These functions are used for adding or removing observers from the observer 117 // These functions are used for adding or removing observers from the observer
114 // list. The observers are notified when animations end. 118 // list. The observers are notified when animations end.
115 void AddObserver(LayerAnimationObserver* observer); 119 void AddObserver(LayerAnimationObserver* observer);
116 void RemoveObserver(LayerAnimationObserver* observer); 120 void RemoveObserver(LayerAnimationObserver* observer);
117 121
118 // For testing purposes only.
119 void set_disable_timer_for_test(bool disable_timer) {
120 disable_timer_for_test_ = disable_timer;
121 }
122 base::TimeTicks last_step_time() const { return last_step_time_; }
123
124 // When set to true, all animations complete immediately.
125 static void set_disable_animations_for_test(bool disable_animations) {
126 disable_animations_for_test_ = disable_animations;
127 }
128
129 protected: 122 protected:
130 LayerAnimationDelegate* delegate() { return delegate_; } 123 LayerAnimationDelegate* delegate() { return delegate_; }
131 const LayerAnimationDelegate* delegate() const { return delegate_; } 124 const LayerAnimationDelegate* delegate() const { return delegate_; }
132 125
133 private: 126 private:
134 friend class ScopedLayerAnimationSettings; 127 friend class ScopedLayerAnimationSettings;
135 128
136 // We need to keep track of the start time of every running animation. 129 // We need to keep track of the start time of every running animation.
137 struct RunningAnimation { 130 struct RunningAnimation {
138 RunningAnimation(LayerAnimationSequence* sequence, 131 RunningAnimation(LayerAnimationSequence* sequence,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Used for coordinating the starting of animations. 226 // Used for coordinating the starting of animations.
234 base::TimeTicks last_step_time_; 227 base::TimeTicks last_step_time_;
235 228
236 // True if we are being stepped by our container. 229 // True if we are being stepped by our container.
237 bool is_started_; 230 bool is_started_;
238 231
239 // This prevents the animator from automatically stepping through animations 232 // This prevents the animator from automatically stepping through animations
240 // and allows for manual stepping. 233 // and allows for manual stepping.
241 bool disable_timer_for_test_; 234 bool disable_timer_for_test_;
242 235
243 // This causes all animations to complete immediately.
244 static bool disable_animations_for_test_;
245
246 // Observers are notified when layer animations end, are scheduled or are 236 // Observers are notified when layer animations end, are scheduled or are
247 // aborted. 237 // aborted.
248 ObserverList<LayerAnimationObserver> observers_; 238 ObserverList<LayerAnimationObserver> observers_;
249 239
250 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); 240 DISALLOW_COPY_AND_ASSIGN(LayerAnimator);
251 }; 241 };
252 242
253 } // namespace ui 243 } // namespace ui
254 244
255 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ 245 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_
OLDNEW
« no previous file with comments | « ui/gfx/compositor/layer_animation_observer.cc ('k') | ui/gfx/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698