OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/animation/layer_animation_controller.h" | 5 #include "cc/animation/layer_animation_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/animation/animation.h" | 9 #include "cc/animation/animation.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 other_controller->active_animations_.clear(); | 135 other_controller->active_animations_.clear(); |
136 active_animations_.swap(other_controller->active_animations_); | 136 active_animations_.swap(other_controller->active_animations_); |
137 UpdateActivation(NormalActivation); | 137 UpdateActivation(NormalActivation); |
138 set_force_sync(); | 138 set_force_sync(); |
139 other_controller->UpdateActivation(NormalActivation); | 139 other_controller->UpdateActivation(NormalActivation); |
140 other_controller->set_force_sync(); | 140 other_controller->set_force_sync(); |
141 other_controller->SetAnimationRegistrar(registrar_); | 141 other_controller->SetAnimationRegistrar(registrar_); |
142 } | 142 } |
143 | 143 |
144 void LayerAnimationController::Animate(double monotonic_time) { | 144 void LayerAnimationController::Animate(double monotonic_time) { |
145 if (!HasActiveValueObserver()) | 145 if (!HasValueObserver()) |
146 return; | 146 return; |
147 | 147 |
148 StartAnimationsWaitingForNextTick(monotonic_time); | 148 StartAnimationsWaitingForNextTick(monotonic_time); |
149 StartAnimationsWaitingForStartTime(monotonic_time); | 149 StartAnimationsWaitingForStartTime(monotonic_time); |
150 StartAnimationsWaitingForTargetAvailability(monotonic_time); | 150 StartAnimationsWaitingForTargetAvailability(monotonic_time); |
151 ResolveConflicts(monotonic_time); | 151 ResolveConflicts(monotonic_time); |
152 TickAnimations(monotonic_time); | 152 TickAnimations(monotonic_time); |
153 last_tick_time_ = monotonic_time; | 153 last_tick_time_ = monotonic_time; |
154 } | 154 } |
155 | 155 |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 OnOpacityAnimated(opacity)); | 709 OnOpacityAnimated(opacity)); |
710 } | 710 } |
711 | 711 |
712 void LayerAnimationController::NotifyObserversTransformAnimated( | 712 void LayerAnimationController::NotifyObserversTransformAnimated( |
713 const gfx::Transform& transform) { | 713 const gfx::Transform& transform) { |
714 FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 714 FOR_EACH_OBSERVER(LayerAnimationValueObserver, |
715 value_observers_, | 715 value_observers_, |
716 OnTransformAnimated(transform)); | 716 OnTransformAnimated(transform)); |
717 } | 717 } |
718 | 718 |
| 719 bool LayerAnimationController::HasValueObserver() { |
| 720 if (value_observers_.might_have_observers()) { |
| 721 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 722 value_observers_); |
| 723 return it.GetNext() != NULL; |
| 724 } |
| 725 return false; |
| 726 } |
| 727 |
719 bool LayerAnimationController::HasActiveValueObserver() { | 728 bool LayerAnimationController::HasActiveValueObserver() { |
720 if (value_observers_.might_have_observers()) { | 729 if (value_observers_.might_have_observers()) { |
721 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 730 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
722 value_observers_); | 731 value_observers_); |
723 LayerAnimationValueObserver* obs; | 732 LayerAnimationValueObserver* obs; |
724 while ((obs = it.GetNext()) != NULL) | 733 while ((obs = it.GetNext()) != NULL) |
725 if (obs->IsActive()) | 734 if (obs->IsActive()) |
726 return true; | 735 return true; |
727 } | 736 } |
728 return false; | 737 return false; |
729 } | 738 } |
730 | 739 |
731 } // namespace cc | 740 } // namespace cc |
OLD | NEW |