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/compositor/layer_animator.h" | 5 #include "ui/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 "cc/animation/animation_id_provider.h" | 10 #include "cc/animation/animation_id_provider.h" |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 bool LayerAnimator::StartSequenceImmediately(LayerAnimationSequence* sequence) { | 752 bool LayerAnimator::StartSequenceImmediately(LayerAnimationSequence* sequence) { |
753 PurgeDeletedAnimations(); | 753 PurgeDeletedAnimations(); |
754 | 754 |
755 // Ensure that no one is animating one of the sequence's properties already. | 755 // Ensure that no one is animating one of the sequence's properties already. |
756 for (RunningAnimations::const_iterator iter = running_animations_.begin(); | 756 for (RunningAnimations::const_iterator iter = running_animations_.begin(); |
757 iter != running_animations_.end(); ++iter) { | 757 iter != running_animations_.end(); ++iter) { |
758 if ((*iter).sequence()->HasConflictingProperty(sequence->properties())) | 758 if ((*iter).sequence()->HasConflictingProperty(sequence->properties())) |
759 return false; | 759 return false; |
760 } | 760 } |
761 | 761 |
762 // All clear, actually start the sequence. Note: base::TimeTicks::Now has | 762 // All clear, actually start the sequence. |
763 // a resolution that can be as bad as 15ms. If this causes glitches in the | |
764 // animations, this can be switched to HighResNow() (animation uses Now() | |
765 // internally). | |
766 // All LayerAnimators share the same LayerAnimatorCollection. Use the | 763 // All LayerAnimators share the same LayerAnimatorCollection. Use the |
767 // last_tick_time() from there to ensure animations started during the same | 764 // last_tick_time() from there to ensure animations started during the same |
768 // event complete at the same time. | 765 // event complete at the same time. |
769 base::TimeTicks start_time; | 766 base::TimeTicks start_time; |
770 LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); | 767 LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); |
771 if (is_animating() || adding_animations_) | 768 if (is_animating() || adding_animations_) |
772 start_time = last_step_time_; | 769 start_time = last_step_time_; |
773 else if (collection && collection->HasActiveAnimators()) | 770 else if (collection && collection->HasActiveAnimators()) |
774 start_time = collection->last_tick_time(); | 771 start_time = collection->last_tick_time(); |
775 else | 772 else |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 852 } |
856 | 853 |
857 LayerAnimator::RunningAnimation::RunningAnimation( | 854 LayerAnimator::RunningAnimation::RunningAnimation( |
858 const base::WeakPtr<LayerAnimationSequence>& sequence) | 855 const base::WeakPtr<LayerAnimationSequence>& sequence) |
859 : sequence_(sequence) { | 856 : sequence_(sequence) { |
860 } | 857 } |
861 | 858 |
862 LayerAnimator::RunningAnimation::~RunningAnimation() { } | 859 LayerAnimator::RunningAnimation::~RunningAnimation() { } |
863 | 860 |
864 } // namespace ui | 861 } // namespace ui |
OLD | NEW |