diff options
author | jonross <jonross@chromium.org> | 2015-04-23 15:10:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-23 22:10:34 +0000 |
commit | 7351feb919cdd81f991904e6763956a15d2b4a83 (patch) | |
tree | 69a1e4f80ad74076d386d5f29d7b20987d2ac70d /ash | |
parent | c08969c1b8b723494569c893b15c9b2e634ef0fc (diff) | |
download | chromium_src-7351feb919cdd81f991904e6763956a15d2b4a83.zip chromium_src-7351feb919cdd81f991904e6763956a15d2b4a83.tar.gz chromium_src-7351feb919cdd81f991904e6763956a15d2b4a83.tar.bz2 |
Have ScreenRotationAnimator abort animations before deleting layer tree
When ScreenRotationAnimator copies the layer tree, LayerAnimationObservers
remain attached to the original LayerAnimators.
When the rotation animation completed the old layer tree was deleted. This
causes animations to be deleted without notifying their observers.
LayerAnimationObserver has been updated to abort all animations on the old tree
before deleting the tree. Allowing observers to update the state of their view,
and to properly delete themselves.
TEST=OverviewButtonTrayTest.HideAnimationAlwaysCompletes, and manual testing of rotation
BUG=479727
Review URL: https://codereview.chromium.org/1101133003
Cr-Commit-Position: refs/heads/master@{#326668}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/rotator/screen_rotation_animator.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ash/rotator/screen_rotation_animator.cc b/ash/rotator/screen_rotation_animator.cc index 8756219..8517759 100644 --- a/ash/rotator/screen_rotation_animator.cc +++ b/ash/rotator/screen_rotation_animator.cc @@ -103,6 +103,10 @@ class LayerCleanupObserver : public ui::LayerAnimationObserver { void OnDetachedFromSequence(ui::LayerAnimationSequence* sequence) override; private: + // Aborts the active animations of the layer, and recurses upon its child + // layers. + void AbortAnimations(ui::Layer* layer); + // The owned layer tree. scoped_ptr<ui::LayerTreeOwner> layer_tree_owner_; @@ -123,6 +127,7 @@ LayerCleanupObserver::~LayerCleanupObserver() { // RequiresNotificationWhenAnimatorDestroyed. if (sequence_) sequence_->RemoveObserver(this); + AbortAnimations(layer_tree_owner_->root()); } ui::Layer* LayerCleanupObserver::GetRootLayer() { @@ -150,6 +155,12 @@ void LayerCleanupObserver::OnDetachedFromSequence( sequence_ = nullptr; } +void LayerCleanupObserver::AbortAnimations(ui::Layer* layer) { + for (ui::Layer* child_layer : layer->children()) + AbortAnimations(child_layer); + layer->GetAnimator()->AbortAllAnimations(); +} + // Set the screen orientation for the given |display| to |new_rotation| and // animate the change. void RotateScreen(int64 display_id, |