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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 292 } |
293 | 293 |
294 void LayerAnimator::FinishAnimation(LayerAnimationSequence* sequence) { | 294 void LayerAnimator::FinishAnimation(LayerAnimationSequence* sequence) { |
295 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); | 295 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); |
296 sequence->Progress(sequence->duration(), delegate()); | 296 sequence->Progress(sequence->duration(), delegate()); |
297 ProcessQueue(); | 297 ProcessQueue(); |
298 UpdateAnimationState(); | 298 UpdateAnimationState(); |
299 } | 299 } |
300 | 300 |
301 void LayerAnimator::FinishAnyAnimationWithZeroDuration() { | 301 void LayerAnimator::FinishAnyAnimationWithZeroDuration() { |
302 // We need to make a copy because Progress may indirectly cause new animations | 302 // Special case: if we've started a 0 duration animation, just finish it now |
303 // to start running. | 303 // and get rid of it. We need to make a copy because Progress may indirectly |
| 304 // cause new animations to start running. |
304 RunningAnimations running_animations_copy = running_animations_; | 305 RunningAnimations running_animations_copy = running_animations_; |
305 for (size_t i = 0; i < running_animations_copy.size(); ++i) { | 306 for (size_t i = 0; i < running_animations_copy.size(); ++i) { |
306 if (running_animations_copy[i].sequence->duration() == base::TimeDelta()) { | 307 if (running_animations_copy[i].sequence->duration() == base::TimeDelta()) { |
307 running_animations_copy[i].sequence->Progress( | 308 running_animations_copy[i].sequence->Progress( |
308 running_animations_copy[i].sequence->duration(), delegate()); | 309 running_animations_copy[i].sequence->duration(), delegate()); |
309 scoped_ptr<LayerAnimationSequence> removed( | 310 scoped_ptr<LayerAnimationSequence> removed( |
310 RemoveAnimation(running_animations_copy[i].sequence)); | 311 RemoveAnimation(running_animations_copy[i].sequence)); |
311 } | 312 } |
312 } | 313 } |
313 ProcessQueue(); | 314 ProcessQueue(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); | 528 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); |
528 LayerAnimationObserver* obs; | 529 LayerAnimationObserver* obs; |
529 while ((obs = it.GetNext()) != NULL) { | 530 while ((obs = it.GetNext()) != NULL) { |
530 sequence->AddObserver(obs); | 531 sequence->AddObserver(obs); |
531 } | 532 } |
532 } | 533 } |
533 sequence->OnScheduled(); | 534 sequence->OnScheduled(); |
534 } | 535 } |
535 | 536 |
536 } // namespace ui | 537 } // namespace ui |
OLD | NEW |