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

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

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/gfx/compositor/layer_animation_observer.h ('k') | ui/gfx/compositor/layer_animator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/compositor/layer_animation_observer.cc
diff --git a/ui/gfx/compositor/layer_animation_observer.cc b/ui/gfx/compositor/layer_animation_observer.cc
index 23217a57df6f23b50afdbdb0590d296832612f8b..a477bde1220f5d594ac9556a530e7aa49568e524 100644
--- a/ui/gfx/compositor/layer_animation_observer.cc
+++ b/ui/gfx/compositor/layer_animation_observer.cc
@@ -11,14 +11,26 @@ namespace ui {
////////////////////////////////////////////////////////////////////////////////
// LayerAnimationObserver
+LayerAnimationObserver::LayerAnimationObserver() {
+}
+
+LayerAnimationObserver::~LayerAnimationObserver() {
+ StopObserving();
+}
+
bool LayerAnimationObserver::RequiresNotificationWhenAnimatorDestroyed() const {
return false;
}
-LayerAnimationObserver::LayerAnimationObserver() {
+void LayerAnimationObserver::OnAttachedToSequence(
+ LayerAnimationSequence* sequence) {
}
-LayerAnimationObserver::~LayerAnimationObserver() {
+void LayerAnimationObserver::OnDetachedFromSequence(
+ LayerAnimationSequence* sequence) {
+}
+
+void LayerAnimationObserver::StopObserving() {
while (!attached_sequences_.empty()) {
LayerAnimationSequence* sequence = *attached_sequences_.begin();
sequence->RemoveObserver(this);
@@ -29,20 +41,21 @@ void LayerAnimationObserver::AttachedToSequence(
LayerAnimationSequence* sequence) {
DCHECK(attached_sequences_.find(sequence) == attached_sequences_.end());
attached_sequences_.insert(sequence);
+ OnAttachedToSequence(sequence);
}
void LayerAnimationObserver::DetachedFromSequence(
LayerAnimationSequence* sequence) {
if (attached_sequences_.find(sequence) != attached_sequences_.end())
attached_sequences_.erase(sequence);
+ OnDetachedFromSequence(sequence);
}
////////////////////////////////////////////////////////////////////////////////
// ImplicitAnimationObserver
ImplicitAnimationObserver::ImplicitAnimationObserver()
- : active_(false),
- animation_count_(0) {
+ : active_(false) {
}
ImplicitAnimationObserver::~ImplicitAnimationObserver() {}
@@ -52,26 +65,44 @@ void ImplicitAnimationObserver::SetActive(bool active) {
CheckCompleted();
}
+void ImplicitAnimationObserver::StopObservingImplicitAnimations() {
+ SetActive(false);
+ StopObserving();
+}
+
void ImplicitAnimationObserver::OnLayerAnimationEnded(
- const LayerAnimationSequence* sequence) {
- animation_count_--;
+ LayerAnimationSequence* sequence) {
+ sequence->RemoveObserver(this);
+ DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
CheckCompleted();
}
void ImplicitAnimationObserver::OnLayerAnimationAborted(
- const LayerAnimationSequence* sequence) {
- animation_count_--;
+ LayerAnimationSequence* sequence) {
+ sequence->RemoveObserver(this);
+ DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
CheckCompleted();
}
void ImplicitAnimationObserver::OnLayerAnimationScheduled(
- const LayerAnimationSequence* sequence) {
- animation_count_++;
+ LayerAnimationSequence* sequence) {
+}
+
+void ImplicitAnimationObserver::OnAttachedToSequence(
+ LayerAnimationSequence* sequence) {
+}
+
+void ImplicitAnimationObserver::OnDetachedFromSequence(
+ LayerAnimationSequence* sequence) {
+ DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
+ CheckCompleted();
}
void ImplicitAnimationObserver::CheckCompleted() {
- if (active_ && animation_count_ == 0)
+ if (active_ && attached_sequences().empty()) {
OnImplicitAnimationsCompleted();
+ active_ = false;
+ }
}
} // namespace ui
« no previous file with comments | « ui/gfx/compositor/layer_animation_observer.h ('k') | ui/gfx/compositor/layer_animator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698