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

Side by Side Diff: ui/wm/core/window_animations.cc

Issue 343753007: Fix a leak in wm::AnimateOnChildWindowVisibilityChanged(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: The fix together with the test only, which will not fail on LSan bots anymore. Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/window_animations_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/wm/core/window_animations.h" 5 #include "ui/wm/core/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 window_->parent()->layer()->StackAbove( 105 window_->parent()->layer()->StackAbove(
106 layer_owner_->root(), topmost_transient_child->layer()); 106 layer_owner_->root(), topmost_transient_child->layer());
107 } 107 }
108 } 108 }
109 } 109 }
110 110
111 protected: 111 protected:
112 // Invoked when the hiding animation is completed. It will delete 112 // Invoked when the hiding animation is completed. It will delete
113 // 'this', and no operation should be made on this object after this 113 // 'this', and no operation should be made on this object after this
114 // point. 114 // point.
115 void OnAnimationCompleted() { 115 void OnAnimationCompleted() {
sky 2014/06/27 22:32:56 I would have thought we end up here. What particul
116 // Window may have been destroyed by this point. 116 // Window may have been destroyed by this point.
117 if (window_) { 117 if (window_) {
118 aura::client::AnimationHost* animation_host = 118 aura::client::AnimationHost* animation_host =
119 aura::client::GetAnimationHost(window_); 119 aura::client::GetAnimationHost(window_);
120 if (animation_host) 120 if (animation_host)
121 animation_host->OnWindowHidingAnimationCompleted(); 121 animation_host->OnWindowHidingAnimationCompleted();
122 window_->RemoveObserver(this);
123 } 122 }
124 delete this; 123 delete this;
125 } 124 }
126 125
127 private: 126 private:
128 // Invoked when the window is destroyed (or destroying). 127 // Invoked when the window is destroyed (or destroying).
129 void WindowInvalid() { 128 void WindowInvalid() {
130 layer_owner_->root()->SuppressPaint(); 129 layer_owner_->root()->SuppressPaint();
131 130 delete this;
132 window_->RemoveObserver(this);
133 window_ = NULL;
134 } 131 }
135 132
136 aura::Window* window_; 133 aura::Window* window_;
137 134
138 // The owner of detached layers. 135 // The owner of detached layers.
139 scoped_ptr<ui::LayerTreeOwner> layer_owner_; 136 scoped_ptr<ui::LayerTreeOwner> layer_owner_;
140 137
141 DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserverBase); 138 DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserverBase);
142 }; 139 };
143 140
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 646 }
650 647
651 bool WindowAnimationsDisabled(aura::Window* window) { 648 bool WindowAnimationsDisabled(aura::Window* window) {
652 return (!gfx::Animation::ShouldRenderRichAnimation() || (window && 649 return (!gfx::Animation::ShouldRenderRichAnimation() || (window &&
653 window->GetProperty(aura::client::kAnimationsDisabledKey)) || 650 window->GetProperty(aura::client::kAnimationsDisabledKey)) ||
654 CommandLine::ForCurrentProcess()->HasSwitch( 651 CommandLine::ForCurrentProcess()->HasSwitch(
655 switches::kWindowAnimationsDisabled)); 652 switches::kWindowAnimationsDisabled));
656 } 653 }
657 654
658 } // namespace wm 655 } // namespace wm
OLDNEW
« no previous file with comments | « ash/wm/window_animations_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698