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

Side by Side Diff: views/animation/bounds_animator.cc

Issue 1609008: Adds some debugging info in hopes of tracking leak in (Closed)
Patch Set: Removes supression Created 10 years, 8 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
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/animation/bounds_animator.h" 5 #include "views/animation/bounds_animator.h"
6 6
7 #include "app/slide_animation.h" 7 #include "app/slide_animation.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "views/view.h" 9 #include "views/view.h"
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 animation->Show(); 80 animation->Show();
81 } 81 }
82 82
83 const SlideAnimation* BoundsAnimator::GetAnimationForView(View* view) { 83 const SlideAnimation* BoundsAnimator::GetAnimationForView(View* view) {
84 return data_.find(view) == data_.end() ? NULL : data_[view].animation; 84 return data_.find(view) == data_.end() ? NULL : data_[view].animation;
85 } 85 }
86 86
87 void BoundsAnimator::SetAnimationDelegate(View* view, 87 void BoundsAnimator::SetAnimationDelegate(View* view,
88 AnimationDelegate* delegate, 88 AnimationDelegate* delegate,
89 bool delete_when_done) { 89 bool delete_when_done) {
90 #if defined(OS_LINUX)
91 if (!IsAnimating(view))
92 LOG(ERROR) << "SetAnimationDelegate: not animating view";
93 if (data_[view].delegate)
94 LOG(ERROR) << "SetAnimationDelegate: delegate already set: leaking";
95 #endif
96
90 DCHECK(IsAnimating(view)); 97 DCHECK(IsAnimating(view));
91 data_[view].delegate = delegate; 98 data_[view].delegate = delegate;
92 data_[view].delete_delegate_when_done = delete_when_done; 99 data_[view].delete_delegate_when_done = delete_when_done;
93 } 100 }
94 101
95 void BoundsAnimator::StopAnimatingView(View* view) { 102 void BoundsAnimator::StopAnimatingView(View* view) {
96 if (data_.find(view) == data_.end()) 103 if (data_.find(view) == data_.end())
97 return; 104 return;
98 105
99 data_[view].animation->Stop(); 106 data_[view].animation->Stop();
100 } 107 }
101 108
102 bool BoundsAnimator::IsAnimating(View* view) const { 109 bool BoundsAnimator::IsAnimating(View* view) const {
103 return data_.find(view) != data_.end(); 110 return data_.find(view) != data_.end();
104 } 111 }
105 112
106 bool BoundsAnimator::IsAnimating() const { 113 bool BoundsAnimator::IsAnimating() const {
107 return !data_.empty(); 114 return !data_.empty();
108 } 115 }
109 116
110 void BoundsAnimator::Cancel() { 117 void BoundsAnimator::Cancel() {
111 if (data_.empty()) 118 if (data_.empty())
112 return; 119 return;
113 120
121 #if defined(OS_LINUX)
122 LOG(ERROR) << "Cancelling animations";
123 #endif
124
114 while (!data_.empty()) 125 while (!data_.empty())
115 data_.begin()->second.animation->Stop(); 126 data_.begin()->second.animation->Stop();
116 127
117 // Invoke AnimationContainerProgressed to force a repaint and notify delegate. 128 // Invoke AnimationContainerProgressed to force a repaint and notify delegate.
118 AnimationContainerProgressed(container_.get()); 129 AnimationContainerProgressed(container_.get());
119 } 130 }
120 131
121 SlideAnimation* BoundsAnimator::CreateAnimation() { 132 SlideAnimation* BoundsAnimator::CreateAnimation() {
122 SlideAnimation* animation = new SlideAnimation(this); 133 SlideAnimation* animation = new SlideAnimation(this);
123 animation->SetContainer(container_.get()); 134 animation->SetContainer(container_.get());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Notify here rather than from AnimationXXX to avoid deleting the animation 235 // Notify here rather than from AnimationXXX to avoid deleting the animation
225 // while the animaion is calling us. 236 // while the animaion is calling us.
226 observer_->OnBoundsAnimatorDone(this); 237 observer_->OnBoundsAnimatorDone(this);
227 } 238 }
228 } 239 }
229 240
230 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { 241 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) {
231 } 242 }
232 243
233 } // namespace views 244 } // namespace views
OLDNEW
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698