| OLD | NEW |
| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 RemoveAnimation(sequences[i])); | 386 RemoveAnimation(sequences[i])); |
| 387 if (abort) | 387 if (abort) |
| 388 sequences[i]->Abort(); | 388 sequences[i]->Abort(); |
| 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 // Ensure that sequence is disposed of when this function completes. |
| 397 scoped_ptr<LayerAnimationSequence> to_dispose(sequence); |
| 396 const bool abort = false; | 398 const bool abort = false; |
| 397 RemoveAllAnimationsWithACommonProperty(sequence, abort); | 399 RemoveAllAnimationsWithACommonProperty(sequence, abort); |
| 398 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); | 400 LayerAnimationSequence* removed = RemoveAnimation(sequence); |
| 401 DCHECK(removed == NULL || removed == sequence); |
| 399 sequence->Progress(sequence->duration(), delegate()); | 402 sequence->Progress(sequence->duration(), delegate()); |
| 400 } | 403 } |
| 401 | 404 |
| 402 void LayerAnimator::ImmediatelyAnimateToNewTarget( | 405 void LayerAnimator::ImmediatelyAnimateToNewTarget( |
| 403 LayerAnimationSequence* sequence) { | 406 LayerAnimationSequence* sequence) { |
| 404 const bool abort = true; | 407 const bool abort = true; |
| 405 RemoveAllAnimationsWithACommonProperty(sequence, abort); | 408 RemoveAllAnimationsWithACommonProperty(sequence, abort); |
| 406 AddToQueueIfNotPresent(sequence); | 409 AddToQueueIfNotPresent(sequence); |
| 407 StartSequenceImmediately(sequence); | 410 StartSequenceImmediately(sequence); |
| 408 } | 411 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); | 526 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); |
| 524 LayerAnimationObserver* obs; | 527 LayerAnimationObserver* obs; |
| 525 while ((obs = it.GetNext()) != NULL) { | 528 while ((obs = it.GetNext()) != NULL) { |
| 526 sequence->AddObserver(obs); | 529 sequence->AddObserver(obs); |
| 527 } | 530 } |
| 528 } | 531 } |
| 529 sequence->OnScheduled(); | 532 sequence->OnScheduled(); |
| 530 } | 533 } |
| 531 | 534 |
| 532 } // namespace ui | 535 } // namespace ui |
| OLD | NEW |