| Index: cc/animation/animation_registrar.cc
|
| diff --git a/cc/animation/animation_registrar.cc b/cc/animation/animation_registrar.cc
|
| index 5327926b1cc9ee6b208d8b9d3e6cf3b0d1e26088..3fb8055e1912c5b7063506f1d4f728017d2fda46 100644
|
| --- a/cc/animation/animation_registrar.cc
|
| +++ b/cc/animation/animation_registrar.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "cc/animation/animation_registrar.h"
|
|
|
| +#include "base/trace_event/trace_event_argument.h"
|
| #include "cc/animation/layer_animation_controller.h"
|
|
|
| namespace cc {
|
| @@ -55,4 +56,75 @@ void AnimationRegistrar::UnregisterAnimationController(
|
| DidDeactivateAnimationController(controller);
|
| }
|
|
|
| +bool AnimationRegistrar::ActivateAnimations() {
|
| + if (!needs_animate_layers())
|
| + return false;
|
| +
|
| + TRACE_EVENT0("cc", "AnimationRegistrar::ActivateAnimations");
|
| + AnimationControllerMap active_controllers_copy =
|
| + active_animation_controllers_;
|
| + for (auto& it : active_controllers_copy)
|
| + it.second->ActivateAnimations();
|
| +
|
| + return true;
|
| +}
|
| +
|
| +bool AnimationRegistrar::AnimateLayers(base::TimeTicks monotonic_time) {
|
| + if (!needs_animate_layers())
|
| + return false;
|
| +
|
| + TRACE_EVENT0("cc", "AnimationRegistrar::AnimateLayers");
|
| + AnimationControllerMap controllers_copy = active_animation_controllers_;
|
| + for (auto& it : controllers_copy)
|
| + it.second->Animate(monotonic_time);
|
| +
|
| + return true;
|
| +}
|
| +
|
| +bool AnimationRegistrar::UpdateAnimationState(bool start_ready_animations,
|
| + AnimationEventsVector* events) {
|
| + if (!needs_animate_layers())
|
| + return false;
|
| +
|
| + TRACE_EVENT0("cc", "AnimationRegistrar::UpdateAnimationState");
|
| + AnimationControllerMap active_controllers_copy =
|
| + active_animation_controllers_;
|
| + for (auto& it : active_controllers_copy)
|
| + it.second->UpdateState(start_ready_animations, events);
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void AnimationRegistrar::SetAnimationEvents(
|
| + scoped_ptr<AnimationEventsVector> events) {
|
| + for (size_t event_index = 0; event_index < events->size(); ++event_index) {
|
| + int event_layer_id = (*events)[event_index].layer_id;
|
| +
|
| + // Use the map of all controllers, not just active ones, since non-active
|
| + // controllers may still receive events for impl-only animations.
|
| + const AnimationRegistrar::AnimationControllerMap& animation_controllers =
|
| + all_animation_controllers_;
|
| + auto iter = animation_controllers.find(event_layer_id);
|
| + if (iter != animation_controllers.end()) {
|
| + switch ((*events)[event_index].type) {
|
| + case AnimationEvent::STARTED:
|
| + (*iter).second->NotifyAnimationStarted((*events)[event_index]);
|
| + break;
|
| +
|
| + case AnimationEvent::FINISHED:
|
| + (*iter).second->NotifyAnimationFinished((*events)[event_index]);
|
| + break;
|
| +
|
| + case AnimationEvent::ABORTED:
|
| + (*iter).second->NotifyAnimationAborted((*events)[event_index]);
|
| + break;
|
| +
|
| + case AnimationEvent::PROPERTY_UPDATE:
|
| + (*iter).second->NotifyAnimationPropertyUpdate((*events)[event_index]);
|
| + break;
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace cc
|
|
|