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

Side by Side Diff: ui/gfx/compositor/layer_animator.cc

Issue 9371007: Fix a memory leak in the layer animator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove valgrind suppression Created 8 years, 10 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
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/gfx/compositor/layer_animator.h" 5 #include "ui/gfx/compositor/layer_animator.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/base/animation/animation_container.h" 10 #include "ui/base/animation/animation_container.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 else 389 else
390 sequences[i]->Progress(sequences[i]->duration(), delegate()); 390 sequences[i]->Progress(sequences[i]->duration(), delegate());
391 } 391 }
392 } 392 }
393 } 393 }
394 394
395 void LayerAnimator::ImmediatelySetNewTarget(LayerAnimationSequence* sequence) { 395 void LayerAnimator::ImmediatelySetNewTarget(LayerAnimationSequence* sequence) {
396 const bool abort = false; 396 const bool abort = false;
397 RemoveAllAnimationsWithACommonProperty(sequence, abort); 397 RemoveAllAnimationsWithACommonProperty(sequence, abort);
398 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); 398 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence));
399 if (!removed.get())
400 removed.reset(sequence);
sky 2012/02/09 03:48:56 Add a comment here.
399 sequence->Progress(sequence->duration(), delegate()); 401 sequence->Progress(sequence->duration(), delegate());
400 } 402 }
401 403
402 void LayerAnimator::ImmediatelyAnimateToNewTarget( 404 void LayerAnimator::ImmediatelyAnimateToNewTarget(
403 LayerAnimationSequence* sequence) { 405 LayerAnimationSequence* sequence) {
404 const bool abort = true; 406 const bool abort = true;
405 RemoveAllAnimationsWithACommonProperty(sequence, abort); 407 RemoveAllAnimationsWithACommonProperty(sequence, abort);
406 AddToQueueIfNotPresent(sequence); 408 AddToQueueIfNotPresent(sequence);
407 StartSequenceImmediately(sequence); 409 StartSequenceImmediately(sequence);
408 } 410 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); 525 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_);
524 LayerAnimationObserver* obs; 526 LayerAnimationObserver* obs;
525 while ((obs = it.GetNext()) != NULL) { 527 while ((obs = it.GetNext()) != NULL) {
526 sequence->AddObserver(obs); 528 sequence->AddObserver(obs);
527 } 529 }
528 } 530 }
529 sequence->OnScheduled(); 531 sequence->OnScheduled();
530 } 532 }
531 533
532 } // namespace ui 534 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698