OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 | 298 |
299 void LayerAnimator::FinishAnimation(LayerAnimationSequence* sequence) { | 299 void LayerAnimator::FinishAnimation(LayerAnimationSequence* sequence) { |
300 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); | 300 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); |
301 sequence->Progress(sequence->duration(), delegate()); | 301 sequence->Progress(sequence->duration(), delegate()); |
302 ProcessQueue(); | 302 ProcessQueue(); |
303 UpdateAnimationState(); | 303 UpdateAnimationState(); |
304 } | 304 } |
305 | 305 |
306 void LayerAnimator::FinishAnyAnimationWithZeroDuration() { | 306 void LayerAnimator::FinishAnyAnimationWithZeroDuration() { |
307 // We need to make a copy because Progress may indirectly cause new animations | 307 // Special case: if we've started a 0 duration animation, just finish it now |
308 // to start running. | 308 // and get rid of it. We need to make a copy because Progress may indirectly |
| 309 // cause new animations to start running. |
309 RunningAnimations running_animations_copy = running_animations_; | 310 RunningAnimations running_animations_copy = running_animations_; |
310 for (size_t i = 0; i < running_animations_copy.size(); ++i) { | 311 for (size_t i = 0; i < running_animations_copy.size(); ++i) { |
311 if (running_animations_copy[i].sequence->duration() == base::TimeDelta()) { | 312 if (running_animations_copy[i].sequence->duration() == base::TimeDelta()) { |
312 running_animations_copy[i].sequence->Progress( | 313 running_animations_copy[i].sequence->Progress( |
313 running_animations_copy[i].sequence->duration(), delegate()); | 314 running_animations_copy[i].sequence->duration(), delegate()); |
314 scoped_ptr<LayerAnimationSequence> removed( | 315 scoped_ptr<LayerAnimationSequence> removed( |
315 RemoveAnimation(running_animations_copy[i].sequence)); | 316 RemoveAnimation(running_animations_copy[i].sequence)); |
316 } | 317 } |
317 } | 318 } |
318 ProcessQueue(); | 319 ProcessQueue(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); | 533 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); |
533 LayerAnimationObserver* obs; | 534 LayerAnimationObserver* obs; |
534 while ((obs = it.GetNext()) != NULL) { | 535 while ((obs = it.GetNext()) != NULL) { |
535 sequence->AddObserver(obs); | 536 sequence->AddObserver(obs); |
536 } | 537 } |
537 } | 538 } |
538 sequence->OnScheduled(); | 539 sequence->OnScheduled(); |
539 } | 540 } |
540 | 541 |
541 } // namespace ui | 542 } // namespace ui |
OLD | NEW |