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

Unified Diff: ash/wm/window_animations.cc

Issue 10911172: Changes launcher so that when animating hidden the background doesn't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 8 years, 3 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 | « ash/wm/window_animations.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 0e31d8890fc22cc6bee4eaea1e0c04c946ba4b3c..3e648b90403b53e43d6138d16012910f8c4f56a5 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -630,7 +630,11 @@ class CrossFadeObserver : public ui::CompositorObserver,
layer_->GetCompositor()->AddObserver(this);
}
virtual ~CrossFadeObserver() {
- Cleanup();
+ window_->RemoveObserver(this);
+ window_ = NULL;
+ layer_->GetCompositor()->RemoveObserver(this);
+ wm::DeepDeleteLayers(layer_);
+ layer_ = NULL;
}
// ui::CompositorObserver overrides:
@@ -643,19 +647,14 @@ class CrossFadeObserver : public ui::CompositorObserver,
virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE {
}
virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE {
- // Something went wrong with compositing and our layers are now invalid.
- if (layer_)
- layer_->GetAnimator()->StopAnimating();
- // Delete is scheduled in OnImplicitAnimationsCompleted().
- Cleanup();
+ // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
+ layer_->GetAnimator()->StopAnimating();
}
// aura::WindowObserver overrides:
virtual void OnWindowDestroying(Window* window) OVERRIDE {
- if (layer_)
- layer_->GetAnimator()->StopAnimating();
- // Delete is scheduled in OnImplicitAnimationsCompleted().
- Cleanup();
+ // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
+ layer_->GetAnimator()->StopAnimating();
}
// ui::ImplicitAnimationObserver overrides:
@@ -664,20 +663,6 @@ class CrossFadeObserver : public ui::CompositorObserver,
}
private:
- // Can be called multiple times if the window is closed or the compositor
- // fails in the middle of the animation.
- void Cleanup() {
- if (window_) {
- window_->RemoveObserver(this);
- window_ = NULL;
- }
- if (layer_) {
- layer_->GetCompositor()->RemoveObserver(this);
- wm::DeepDeleteLayers(layer_);
- layer_ = NULL;
- }
- }
-
Window* window_; // not owned
Layer* layer_; // owned
@@ -689,19 +674,23 @@ class CrossFadeObserver : public ui::CompositorObserver,
namespace {
+// Duration of cross fades when workspace2 is enabled.
+const int kWorkspaceCrossFadeDurationMs = 333;
+
+// Scales for workspaces above/below current workspace.
+const float kWorkspaceScaleAbove = 1.1f;
+const float kWorkspaceScaleBelow = .9f;
+
// TODO: leaving in for now since Nicholas wants to play with this, remove if we
// leave it at 0.
const int kPauseTimeMS = 0;
-// Duration of cross fades when workspace2 is enabled.
-const int kWorkspaceCrossFadeDurationMs = 333;
+} // namespace
// Amount of time for animating a workspace in or out.
const int kWorkspaceSwitchTimeMS = 333 + kPauseTimeMS;
-// Scales for workspaces above/below current workspace.
-const float kWorkspaceScaleAbove = 1.1f;
-const float kWorkspaceScaleBelow = .9f;
+namespace {
enum WorkspaceScaleType {
WORKSPACE_SCALE_ABOVE,
« no previous file with comments | « ash/wm/window_animations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698