Index: ui/gfx/compositor/layer_animation_observer.cc |
=================================================================== |
--- ui/gfx/compositor/layer_animation_observer.cc (revision 120096) |
+++ ui/gfx/compositor/layer_animation_observer.cc (working copy) |
@@ -11,26 +11,14 @@ |
//////////////////////////////////////////////////////////////////////////////// |
// LayerAnimationObserver |
-LayerAnimationObserver::LayerAnimationObserver() { |
-} |
- |
-LayerAnimationObserver::~LayerAnimationObserver() { |
- StopObserving(); |
-} |
- |
bool LayerAnimationObserver::RequiresNotificationWhenAnimatorDestroyed() const { |
return false; |
} |
-void LayerAnimationObserver::OnAttachedToSequence( |
- LayerAnimationSequence* sequence) { |
+LayerAnimationObserver::LayerAnimationObserver() { |
} |
-void LayerAnimationObserver::OnDetachedFromSequence( |
- LayerAnimationSequence* sequence) { |
-} |
- |
-void LayerAnimationObserver::StopObserving() { |
+LayerAnimationObserver::~LayerAnimationObserver() { |
while (!attached_sequences_.empty()) { |
LayerAnimationSequence* sequence = *attached_sequences_.begin(); |
sequence->RemoveObserver(this); |
@@ -41,21 +29,20 @@ |
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) { |
+ : active_(false), |
+ animation_count_(0) { |
} |
ImplicitAnimationObserver::~ImplicitAnimationObserver() {} |
@@ -65,44 +52,26 @@ |
CheckCompleted(); |
} |
-void ImplicitAnimationObserver::StopObservingImplicitAnimations() { |
- SetActive(false); |
- StopObserving(); |
-} |
- |
void ImplicitAnimationObserver::OnLayerAnimationEnded( |
- LayerAnimationSequence* sequence) { |
- sequence->RemoveObserver(this); |
- DCHECK(attached_sequences().find(sequence) == attached_sequences().end()); |
+ const LayerAnimationSequence* sequence) { |
+ animation_count_--; |
CheckCompleted(); |
} |
void ImplicitAnimationObserver::OnLayerAnimationAborted( |
- LayerAnimationSequence* sequence) { |
- sequence->RemoveObserver(this); |
- DCHECK(attached_sequences().find(sequence) == attached_sequences().end()); |
+ const LayerAnimationSequence* sequence) { |
+ animation_count_--; |
CheckCompleted(); |
} |
void ImplicitAnimationObserver::OnLayerAnimationScheduled( |
- LayerAnimationSequence* sequence) { |
+ const LayerAnimationSequence* sequence) { |
+ animation_count_++; |
} |
-void ImplicitAnimationObserver::OnAttachedToSequence( |
- LayerAnimationSequence* sequence) { |
-} |
- |
-void ImplicitAnimationObserver::OnDetachedFromSequence( |
- LayerAnimationSequence* sequence) { |
- DCHECK(attached_sequences().find(sequence) == attached_sequences().end()); |
- CheckCompleted(); |
-} |
- |
void ImplicitAnimationObserver::CheckCompleted() { |
- if (active_ && attached_sequences().empty()) { |
+ if (active_ && animation_count_ == 0) |
OnImplicitAnimationsCompleted(); |
- active_ = false; |
- } |
} |
} // namespace ui |