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

Unified Diff: ui/gfx/compositor/layer_animation_observer.h

Issue 9222018: reland -- Disable animations during aura tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window_unittest.cc ('k') | ui/gfx/compositor/layer_animation_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/compositor/layer_animation_observer.h
diff --git a/ui/gfx/compositor/layer_animation_observer.h b/ui/gfx/compositor/layer_animation_observer.h
index c35dc60cbae411a1cd1917d7647d295dba4ceb26..a2eb911e566fe9b3f709642685394d6129c7011b 100644
--- a/ui/gfx/compositor/layer_animation_observer.h
+++ b/ui/gfx/compositor/layer_animation_observer.h
@@ -16,22 +16,29 @@ namespace ui {
class LayerAnimationSequence;
class ScopedLayerAnimationSettings;
+class ImplicitAnimationObserver;
// LayerAnimationObservers are notified when animations complete.
class COMPOSITOR_EXPORT LayerAnimationObserver {
public:
// Called when the |sequence| ends. Not called if |sequence| is aborted.
virtual void OnLayerAnimationEnded(
- const LayerAnimationSequence* sequence) = 0;
+ LayerAnimationSequence* sequence) = 0;
// Called if |sequence| is aborted for any reason. Should never do anything
// that may cause another animation to be started.
virtual void OnLayerAnimationAborted(
- const LayerAnimationSequence* sequence) = 0;
+ LayerAnimationSequence* sequence) = 0;
// Called when the animation is scheduled.
virtual void OnLayerAnimationScheduled(
- const LayerAnimationSequence* sequence) = 0;
+ LayerAnimationSequence* sequence) = 0;
+
+ protected:
+ typedef std::set<LayerAnimationSequence*> AttachedSequences;
+
+ LayerAnimationObserver();
+ virtual ~LayerAnimationObserver();
// If the animator is destroyed during an animation, the animations are
// aborted. The resulting NotifyAborted notifications will NOT be sent to
@@ -40,9 +47,18 @@ class COMPOSITOR_EXPORT LayerAnimationObserver {
// OBSERVER WHEN YOU ARE DESTROYED.
virtual bool RequiresNotificationWhenAnimatorDestroyed() const;
- protected:
- LayerAnimationObserver();
- virtual ~LayerAnimationObserver();
+ // Called when |this| is added to |sequence|'s observer list.
+ virtual void OnAttachedToSequence(LayerAnimationSequence* sequence);
+
+ // Called when |this| is removed to |sequence|'s observer list.
+ virtual void OnDetachedFromSequence(LayerAnimationSequence* sequence);
+
+ // Detaches this observer from all sequences it is currently observing.
+ void StopObserving();
+
+ const AttachedSequences& attached_sequences() const {
+ return attached_sequences_;
+ }
private:
friend class LayerAnimationSequence;
@@ -53,7 +69,7 @@ class COMPOSITOR_EXPORT LayerAnimationObserver {
// Called when |this| is removed to |sequence|'s observer list.
void DetachedFromSequence(LayerAnimationSequence* sequence);
- std::set<LayerAnimationSequence*> attached_sequences_;
+ AttachedSequences attached_sequences_;
};
// An implicit animation observer is intended to be used in conjunction with a
@@ -67,29 +83,33 @@ class COMPOSITOR_EXPORT ImplicitAnimationObserver
virtual void OnImplicitAnimationsCompleted() = 0;
+ protected:
+ // Deactivates the observer and clears the collection of animations it is
+ // waiting for.
+ void StopObservingImplicitAnimations();
+
private:
friend class ScopedLayerAnimationSettings;
- // OnImplicitAnimationsCompleted is not fired unless the observer is active.
- bool active() const { return active_; }
- void SetActive(bool active);
-
// LayerAnimationObserver implementation
virtual void OnLayerAnimationEnded(
- const LayerAnimationSequence* sequence) OVERRIDE;
+ LayerAnimationSequence* sequence) OVERRIDE;
virtual void OnLayerAnimationAborted(
- const LayerAnimationSequence* sequence) OVERRIDE;
+ LayerAnimationSequence* sequence) OVERRIDE;
virtual void OnLayerAnimationScheduled(
- const LayerAnimationSequence* sequence) OVERRIDE;
+ LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnAttachedToSequence(
+ LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnDetachedFromSequence(
+ LayerAnimationSequence* sequence) OVERRIDE;
+
+ // OnImplicitAnimationsCompleted is not fired unless the observer is active.
+ bool active() const { return active_; }
+ void SetActive(bool active);
void CheckCompleted();
bool active_;
-
- // This tracks the number of scheduled animations that have yet to complete.
- // If this value is zero, and the observer is active, then
- // OnImplicitAnimationsCompleted is fired.
- size_t animation_count_;
};
} // namespace ui
« no previous file with comments | « ui/aura/window_unittest.cc ('k') | ui/gfx/compositor/layer_animation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698