diff options
author | loyso <loyso@chromium.org> | 2016-01-14 14:55:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-14 22:56:47 +0000 |
commit | e926437dd8e656f66cf83aec9823085cccf807e2 (patch) | |
tree | d53d305f0f4956468671a4723488c06d1d662687 /cc | |
parent | 2900f44f50bf81c8cef2118dbb0d719dae7ae927 (diff) | |
download | chromium_src-e926437dd8e656f66cf83aec9823085cccf807e2.zip chromium_src-e926437dd8e656f66cf83aec9823085cccf807e2.tar.gz chromium_src-e926437dd8e656f66cf83aec9823085cccf807e2.tar.bz2 |
CC Animation: Replace AnimiationEventsVector with AnimiationEvents class.
It allows us to use the forward declaration for AnimiationEvents.
This is a preparation to make AnimiationEvents an abstract class,
unknown for CC.
BUG=575053
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1584743002
Cr-Commit-Position: refs/heads/master@{#369591}
Diffstat (limited to 'cc')
32 files changed, 232 insertions, 228 deletions
diff --git a/cc/animation/animation_events.cc b/cc/animation/animation_events.cc index 40a9031..bb4cbb2 100644 --- a/cc/animation/animation_events.cc +++ b/cc/animation/animation_events.cc @@ -20,4 +20,8 @@ AnimationEvent::AnimationEvent(AnimationEvent::Type type, opacity(0.f) { } +AnimationEvents::AnimationEvents() {} + +AnimationEvents::~AnimationEvents() {} + } // namespace cc diff --git a/cc/animation/animation_events.h b/cc/animation/animation_events.h index d268162..63645ec 100644 --- a/cc/animation/animation_events.h +++ b/cc/animation/animation_events.h @@ -34,7 +34,13 @@ struct CC_EXPORT AnimationEvent { FilterOperations filters; }; -typedef std::vector<AnimationEvent> AnimationEventsVector; +class CC_EXPORT AnimationEvents { + public: + AnimationEvents(); + ~AnimationEvents(); + + std::vector<AnimationEvent> events_; +}; } // namespace cc diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc index 0c684c0..59ce274 100644 --- a/cc/animation/animation_host.cc +++ b/cc/animation/animation_host.cc @@ -8,6 +8,7 @@ #include "base/macros.h" #include "cc/animation/animation_delegate.h" +#include "cc/animation/animation_events.h" #include "cc/animation/animation_id_provider.h" #include "cc/animation/animation_player.h" #include "cc/animation/animation_registrar.h" @@ -357,17 +358,16 @@ bool AnimationHost::AnimateLayers(base::TimeTicks monotonic_time) { } bool AnimationHost::UpdateAnimationState(bool start_ready_animations, - AnimationEventsVector* events) { + AnimationEvents* events) { return animation_registrar_->UpdateAnimationState(start_ready_animations, events); } -scoped_ptr<AnimationEventsVector> AnimationHost::CreateEvents() { +scoped_ptr<AnimationEvents> AnimationHost::CreateEvents() { return animation_registrar_->CreateEvents(); } -void AnimationHost::SetAnimationEvents( - scoped_ptr<AnimationEventsVector> events) { +void AnimationHost::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { return animation_registrar_->SetAnimationEvents(std::move(events)); } diff --git a/cc/animation/animation_host.h b/cc/animation/animation_host.h index 96e9158..1bec4ec0 100644 --- a/cc/animation/animation_host.h +++ b/cc/animation/animation_host.h @@ -12,9 +12,11 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" -#include "cc/animation/animation_events.h" +#include "cc/animation/animation.h" #include "cc/base/cc_export.h" #include "cc/trees/mutator_host_client.h" +#include "ui/gfx/geometry/box_f.h" +#include "ui/gfx/geometry/vector2d_f.h" namespace gfx { class ScrollOffset; @@ -22,6 +24,7 @@ class ScrollOffset; namespace cc { +class AnimationEvents; class AnimationPlayer; class AnimationRegistrar; class AnimationTimeline; @@ -88,10 +91,10 @@ class CC_EXPORT AnimationHost { bool ActivateAnimations(); bool AnimateLayers(base::TimeTicks monotonic_time); bool UpdateAnimationState(bool start_ready_animations, - AnimationEventsVector* events); + AnimationEvents* events); - scoped_ptr<AnimationEventsVector> CreateEvents(); - void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); + scoped_ptr<AnimationEvents> CreateEvents(); + void SetAnimationEvents(scoped_ptr<AnimationEvents> events); bool ScrollOffsetAnimationWasInterrupted(int layer_id) const; diff --git a/cc/animation/animation_registrar.cc b/cc/animation/animation_registrar.cc index c300026..e5ecf83 100644 --- a/cc/animation/animation_registrar.cc +++ b/cc/animation/animation_registrar.cc @@ -8,6 +8,7 @@ #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" +#include "cc/animation/animation_events.h" #include "cc/animation/layer_animation_controller.h" namespace cc { @@ -85,7 +86,7 @@ bool AnimationRegistrar::AnimateLayers(base::TimeTicks monotonic_time) { } bool AnimationRegistrar::UpdateAnimationState(bool start_ready_animations, - AnimationEventsVector* events) { + AnimationEvents* events) { if (!needs_animate_layers()) return false; @@ -98,10 +99,15 @@ bool AnimationRegistrar::UpdateAnimationState(bool start_ready_animations, return true; } +scoped_ptr<AnimationEvents> AnimationRegistrar::CreateEvents() { + return make_scoped_ptr(new AnimationEvents()); +} + 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; + scoped_ptr<AnimationEvents> events) { + for (size_t event_index = 0; event_index < events->events_.size(); + ++event_index) { + int event_layer_id = events->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. @@ -109,21 +115,22 @@ void AnimationRegistrar::SetAnimationEvents( all_animation_controllers_; auto iter = animation_controllers.find(event_layer_id); if (iter != animation_controllers.end()) { - switch ((*events)[event_index].type) { + switch (events->events_[event_index].type) { case AnimationEvent::STARTED: - (*iter).second->NotifyAnimationStarted((*events)[event_index]); + (*iter).second->NotifyAnimationStarted(events->events_[event_index]); break; case AnimationEvent::FINISHED: - (*iter).second->NotifyAnimationFinished((*events)[event_index]); + (*iter).second->NotifyAnimationFinished(events->events_[event_index]); break; case AnimationEvent::ABORTED: - (*iter).second->NotifyAnimationAborted((*events)[event_index]); + (*iter).second->NotifyAnimationAborted(events->events_[event_index]); break; case AnimationEvent::PROPERTY_UPDATE: - (*iter).second->NotifyAnimationPropertyUpdate((*events)[event_index]); + (*iter).second->NotifyAnimationPropertyUpdate( + events->events_[event_index]); break; } } diff --git a/cc/animation/animation_registrar.h b/cc/animation/animation_registrar.h index 5cb21e9..45e49ef 100644 --- a/cc/animation/animation_registrar.h +++ b/cc/animation/animation_registrar.h @@ -9,11 +9,12 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "cc/animation/animation_events.h" +#include "base/time/time.h" #include "cc/base/cc_export.h" namespace cc { +class AnimationEvents; class LayerAnimationController; class CC_EXPORT AnimationRegistrar { @@ -67,13 +68,10 @@ class CC_EXPORT AnimationRegistrar { bool ActivateAnimations(); bool AnimateLayers(base::TimeTicks monotonic_time); bool UpdateAnimationState(bool start_ready_animations, - AnimationEventsVector* events); + AnimationEvents* events); - scoped_ptr<AnimationEventsVector> CreateEvents() { - return make_scoped_ptr(new AnimationEventsVector()); - } - - void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); + scoped_ptr<AnimationEvents> CreateEvents(); + void SetAnimationEvents(scoped_ptr<AnimationEvents> events); private: AnimationRegistrar(); diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc index b909dcc..e4e4513 100644 --- a/cc/animation/layer_animation_controller.cc +++ b/cc/animation/layer_animation_controller.cc @@ -11,6 +11,7 @@ #include "cc/animation/animation.h" #include "cc/animation/animation_delegate.h" +#include "cc/animation/animation_events.h" #include "cc/animation/animation_registrar.h" #include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/layer_animation_value_observer.h" @@ -203,7 +204,7 @@ void LayerAnimationController::Animate(base::TimeTicks monotonic_time) { void LayerAnimationController::AccumulatePropertyUpdates( base::TimeTicks monotonic_time, - AnimationEventsVector* events) { + AnimationEvents* events) { if (!events) return; @@ -226,7 +227,7 @@ void LayerAnimationController::AccumulatePropertyUpdates( animation->curve()->ToFloatAnimationCurve(); event.opacity = float_animation_curve->GetValue(trimmed); event.is_impl_only = true; - events->push_back(event); + events->events_.push_back(event); break; } @@ -238,7 +239,7 @@ void LayerAnimationController::AccumulatePropertyUpdates( animation->curve()->ToTransformAnimationCurve(); event.transform = transform_animation_curve->GetValue(trimmed); event.is_impl_only = true; - events->push_back(event); + events->events_.push_back(event); break; } @@ -250,7 +251,7 @@ void LayerAnimationController::AccumulatePropertyUpdates( animation->curve()->ToFilterAnimationCurve(); event.filters = filter_animation_curve->GetValue(trimmed); event.is_impl_only = true; - events->push_back(event); + events->events_.push_back(event); break; } @@ -269,7 +270,7 @@ void LayerAnimationController::AccumulatePropertyUpdates( } void LayerAnimationController::UpdateState(bool start_ready_animations, - AnimationEventsVector* events) { + AnimationEvents* events) { if (!HasActiveValueObserver()) return; @@ -875,7 +876,7 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) { void LayerAnimationController::PromoteStartedAnimations( base::TimeTicks monotonic_time, - AnimationEventsVector* events) { + AnimationEvents* events) { for (size_t i = 0; i < animations_.size(); ++i) { if (animations_[i]->run_state() == Animation::STARTING && animations_[i]->affects_active_observers()) { @@ -896,7 +897,7 @@ void LayerAnimationController::PromoteStartedAnimations( if (started_event.is_impl_only) NotifyAnimationStarted(started_event); else - events->push_back(started_event); + events->events_.push_back(started_event); } } } @@ -920,7 +921,7 @@ void LayerAnimationController::MarkFinishedAnimations( void LayerAnimationController::MarkAnimationsForDeletion( base::TimeTicks monotonic_time, - AnimationEventsVector* events) { + AnimationEvents* events) { bool marked_animations_for_deletions = false; std::vector<size_t> animations_with_same_group_id; @@ -936,7 +937,7 @@ void LayerAnimationController::MarkAnimationsForDeletion( AnimationEvent aborted_event(AnimationEvent::ABORTED, id_, group_id, animations_[i]->target_property(), monotonic_time); - events->push_back(aborted_event); + events->events_.push_back(aborted_event); } // If on the compositor or on the main thread and received finish event, // animation can be marked for deletion. @@ -1006,7 +1007,7 @@ void LayerAnimationController::MarkAnimationsForDeletion( if (finished_event.is_impl_only) NotifyAnimationFinished(finished_event); else - events->push_back(finished_event); + events->events_.push_back(finished_event); } animations_[animation_index]->SetRunState( Animation::WAITING_FOR_DELETION, monotonic_time); diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h index cbff7aa..60655c5 100644 --- a/cc/animation/layer_animation_controller.h +++ b/cc/animation/layer_animation_controller.h @@ -13,7 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/time/time.h" -#include "cc/animation/animation_events.h" +#include "cc/animation/animation.h" #include "cc/animation/layer_animation_event_observer.h" #include "cc/base/cc_export.h" #include "ui/gfx/geometry/scroll_offset.h" @@ -26,8 +26,8 @@ class Transform; namespace cc { -class Animation; class AnimationDelegate; +class AnimationEvents; class AnimationRegistrar; class FilterOperations; class KeyframeValueList; @@ -59,10 +59,9 @@ class CC_EXPORT LayerAnimationController void Animate(base::TimeTicks monotonic_time); void AccumulatePropertyUpdates(base::TimeTicks monotonic_time, - AnimationEventsVector* events); + AnimationEvents* events); - void UpdateState(bool start_ready_animations, - AnimationEventsVector* events); + void UpdateState(bool start_ready_animations, AnimationEvents* events); // Make animations affect active observers if and only if they affect // pending observers. Any animations that no longer affect any observers @@ -190,10 +189,10 @@ class CC_EXPORT LayerAnimationController void StartAnimations(base::TimeTicks monotonic_time); void PromoteStartedAnimations(base::TimeTicks monotonic_time, - AnimationEventsVector* events); + AnimationEvents* events); void MarkFinishedAnimations(base::TimeTicks monotonic_time); void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, - AnimationEventsVector* events); + AnimationEvents* events); void PurgeAnimationsMarkedForDeletion(); void TickAnimations(base::TimeTicks monotonic_time); diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc index f47b0cf..850123c 100644 --- a/cc/animation/layer_animation_controller_unittest.cc +++ b/cc/animation/layer_animation_controller_unittest.cc @@ -9,6 +9,7 @@ #include "cc/animation/animation.h" #include "cc/animation/animation_curve.h" #include "cc/animation/animation_delegate.h" +#include "cc/animation/animation_events.h" #include "cc/animation/animation_registrar.h" #include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/scroll_offset_animation_curve.h" @@ -149,13 +150,13 @@ TEST(LayerAnimationControllerTest, DoNotClobberStartTimes) { EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY, controller_impl->GetAnimationById(animation_id)->run_state()); - AnimationEventsVector events; + AnimationEvents events; controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, &events); // Synchronize the start times. - EXPECT_EQ(1u, events.size()); - controller->NotifyAnimationStarted(events[0]); + EXPECT_EQ(1u, events.events_.size()); + controller->NotifyAnimationStarted(events.events_[0]); EXPECT_EQ(controller->GetAnimationById(animation_id)->start_time(), controller_impl->GetAnimationById(animation_id)->start_time()); @@ -189,13 +190,13 @@ TEST(LayerAnimationControllerTest, UseSpecifiedStartTimes) { EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY, controller_impl->GetAnimationById(animation_id)->run_state()); - AnimationEventsVector events; + AnimationEvents events; controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, &events); // Synchronize the start times. - EXPECT_EQ(1u, events.size()); - controller->NotifyAnimationStarted(events[0]); + EXPECT_EQ(1u, events.events_.size()); + controller->NotifyAnimationStarted(events.events_[0]); EXPECT_EQ(start_time, controller->GetAnimationById(animation_id)->start_time()); @@ -224,8 +225,7 @@ TEST(LayerAnimationControllerTest, Activation) { scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); controller->AddValueObserver(&dummy); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events = registrar->CreateEvents(); controller->SetAnimationRegistrar(registrar.get()); controller_impl->SetAnimationRegistrar(registrar_impl.get()); @@ -250,8 +250,8 @@ TEST(LayerAnimationControllerTest, Activation) { controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, events.get()); - EXPECT_EQ(1u, events->size()); - controller->NotifyAnimationStarted((*events)[0]); + EXPECT_EQ(1u, events->events_.size()); + controller->NotifyAnimationStarted(events->events_[0]); EXPECT_EQ(1u, registrar->active_animation_controllers_for_testing().size()); EXPECT_EQ(1u, @@ -267,7 +267,7 @@ TEST(LayerAnimationControllerTest, Activation) { controller->GetAnimation(Animation::OPACITY)->run_state()); EXPECT_EQ(1u, registrar->active_animation_controllers_for_testing().size()); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1500)); controller_impl->UpdateState(true, events.get()); @@ -278,8 +278,8 @@ TEST(LayerAnimationControllerTest, Activation) { EXPECT_EQ(0u, registrar_impl->active_animation_controllers_for_testing().size()); - EXPECT_EQ(1u, events->size()); - controller->NotifyAnimationFinished((*events)[0]); + EXPECT_EQ(1u, events->events_.size()); + controller->NotifyAnimationFinished(events->events_[0]); controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1500)); controller->UpdateState(true, nullptr); @@ -331,14 +331,14 @@ TEST(LayerAnimationControllerTest, SyncPause) { TimeTicks time = kInitialTickTime; // Start the animations on each controller. - AnimationEventsVector events; + AnimationEvents events; controller_impl->Animate(time); controller_impl->UpdateState(true, &events); - EXPECT_EQ(1u, events.size()); + EXPECT_EQ(1u, events.events_.size()); controller->Animate(time); controller->UpdateState(true, nullptr); - controller->NotifyAnimationStarted(events[0]); + controller->NotifyAnimationStarted(events.events_[0]); EXPECT_EQ(Animation::RUNNING, controller_impl->GetAnimationById(animation_id)->run_state()); @@ -385,8 +385,7 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) { scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); controller->AddValueObserver(&dummy); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY)); @@ -400,23 +399,23 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) { EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY, controller_impl->GetAnimationById(animation_id)->run_state()); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, events.get()); - EXPECT_EQ(1u, events->size()); - EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type); + EXPECT_EQ(1u, events->events_.size()); + EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type); // Notify main thread controller that the animation has started. - controller->NotifyAnimationStarted((*events)[0]); + controller->NotifyAnimationStarted(events->events_[0]); // Complete animation on impl thread. - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime + TimeDelta::FromSeconds(1)); controller_impl->UpdateState(true, events.get()); - EXPECT_EQ(1u, events->size()); - EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type); + EXPECT_EQ(1u, events->events_.size()); + EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type); - controller->NotifyAnimationFinished((*events)[0]); + controller->NotifyAnimationFinished(events->events_[0]); controller->Animate(kInitialTickTime + TimeDelta::FromSeconds(2)); controller->UpdateState(true, nullptr); @@ -432,8 +431,7 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) { TEST(LayerAnimationControllerTest, AnimationsAreDeleted) { FakeLayerAnimationValueObserver dummy; FakeLayerAnimationValueObserver dummy_impl; - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); scoped_refptr<LayerAnimationController> controller_impl( @@ -451,9 +449,9 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) { controller_impl->UpdateState(true, events.get()); // There should be a STARTED event for the animation. - EXPECT_EQ(1u, events->size()); - EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type); - controller->NotifyAnimationStarted((*events)[0]); + EXPECT_EQ(1u, events->events_.size()); + EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type); + controller->NotifyAnimationStarted(events->events_[0]); controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); controller->UpdateState(true, nullptr); @@ -461,7 +459,7 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) { EXPECT_FALSE(dummy.animation_waiting_for_deletion()); EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion()); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000)); controller_impl->UpdateState(true, events.get()); @@ -469,14 +467,14 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) { EXPECT_TRUE(dummy_impl.animation_waiting_for_deletion()); // There should be a FINISHED event for the animation. - EXPECT_EQ(1u, events->size()); - EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type); + EXPECT_EQ(1u, events->events_.size()); + EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type); // Neither controller should have deleted the animation yet. EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY)); EXPECT_TRUE(controller_impl->GetAnimation(Animation::OPACITY)); - controller->NotifyAnimationFinished((*events)[0]); + controller->NotifyAnimationFinished(events->events_[0]); controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000)); controller->UpdateState(true, nullptr); @@ -495,18 +493,17 @@ TEST(LayerAnimationControllerTest, AnimationsAreDeleted) { // Tests that transitioning opacity from 0 to 1 works as expected. static const AnimationEvent* GetMostRecentPropertyUpdateEvent( - const AnimationEventsVector* events) { + const AnimationEvents* events) { const AnimationEvent* event = 0; - for (size_t i = 0; i < events->size(); ++i) - if ((*events)[i].type == AnimationEvent::PROPERTY_UPDATE) - event = &(*events)[i]; + for (size_t i = 0; i < events->events_.size(); ++i) + if (events->events_[i].type == AnimationEvent::PROPERTY_UPDATE) + event = &events->events_[i]; return event; } TEST(LayerAnimationControllerTest, TrivialTransition) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -536,8 +533,7 @@ TEST(LayerAnimationControllerTest, TrivialTransition) { } TEST(LayerAnimationControllerTest, TrivialTransitionOnImpl) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); @@ -553,7 +549,7 @@ TEST(LayerAnimationControllerTest, TrivialTransitionOnImpl) { controller_impl->UpdateState(true, events.get()); EXPECT_TRUE(controller_impl->HasActiveAnimation()); EXPECT_EQ(0.f, dummy_impl.opacity()); - EXPECT_EQ(1u, events->size()); + EXPECT_EQ(1u, events->events_.size()); const AnimationEvent* start_opacity_event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_EQ(0.f, start_opacity_event->opacity); @@ -563,15 +559,14 @@ TEST(LayerAnimationControllerTest, TrivialTransitionOnImpl) { controller_impl->UpdateState(true, events.get()); EXPECT_EQ(1.f, dummy_impl.opacity()); EXPECT_FALSE(controller_impl->HasActiveAnimation()); - EXPECT_EQ(2u, events->size()); + EXPECT_EQ(2u, events->events_.size()); const AnimationEvent* end_opacity_event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_EQ(1.f, end_opacity_event->opacity); } TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); @@ -603,7 +598,7 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) { controller_impl->UpdateState(true, events.get()); EXPECT_TRUE(controller_impl->HasActiveAnimation()); EXPECT_EQ(gfx::Transform(), dummy_impl.transform()); - EXPECT_EQ(1u, events->size()); + EXPECT_EQ(1u, events->events_.size()); const AnimationEvent* start_transform_event = GetMostRecentPropertyUpdateEvent(events.get()); ASSERT_TRUE(start_transform_event); @@ -618,7 +613,7 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) { controller_impl->UpdateState(true, events.get()); EXPECT_EQ(expected_transform, dummy_impl.transform()); EXPECT_FALSE(controller_impl->HasActiveAnimation()); - EXPECT_EQ(2u, events->size()); + EXPECT_EQ(2u, events->events_.size()); const AnimationEvent* end_transform_event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_EQ(expected_transform, end_transform_event->transform); @@ -626,8 +621,7 @@ TEST(LayerAnimationControllerTest, TrivialTransformOnImpl) { } TEST(LayerAnimationControllerTest, FilterTransition) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -674,8 +668,7 @@ TEST(LayerAnimationControllerTest, FilterTransition) { } TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); @@ -704,7 +697,7 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) { controller_impl->UpdateState(true, events.get()); EXPECT_TRUE(controller_impl->HasActiveAnimation()); EXPECT_EQ(start_filters, dummy_impl.filters()); - EXPECT_EQ(1u, events->size()); + EXPECT_EQ(1u, events->events_.size()); const AnimationEvent* start_filter_event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_TRUE(start_filter_event); @@ -716,7 +709,7 @@ TEST(LayerAnimationControllerTest, FilterTransitionOnImplOnly) { controller_impl->UpdateState(true, events.get()); EXPECT_EQ(end_filters, dummy_impl.filters()); EXPECT_FALSE(controller_impl->HasActiveAnimation()); - EXPECT_EQ(2u, events->size()); + EXPECT_EQ(2u, events->events_.size()); const AnimationEvent* end_filter_event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_TRUE(end_filter_event); @@ -731,8 +724,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) { LayerAnimationController::Create(0)); controller_impl->AddValueObserver(&dummy_impl); controller_impl->set_value_provider(&dummy_provider_impl); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; FakeLayerAnimationValueProvider dummy_provider; scoped_refptr<LayerAnimationController> controller( @@ -775,7 +767,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransition) { const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_FALSE(event); - controller->NotifyAnimationStarted((*events)[0]); + controller->NotifyAnimationStarted(events->events_[0]); controller->Animate(kInitialTickTime + duration / 2); controller->UpdateState(true, nullptr); EXPECT_TRUE(controller->HasActiveAnimation()); @@ -809,8 +801,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) { scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); controller_impl->AddValueObserver(&dummy_impl); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; FakeLayerAnimationValueProvider dummy_provider; scoped_refptr<LayerAnimationController> controller( @@ -853,8 +844,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionNoImplProvider) { const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get()); EXPECT_FALSE(event); - - controller->NotifyAnimationStarted((*events)[0]); + controller->NotifyAnimationStarted(events->events_[0]); controller->Animate(kInitialTickTime + duration / 2); controller->UpdateState(true, nullptr); EXPECT_TRUE(controller->HasActiveAnimation()); @@ -885,8 +875,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) { scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); controller_impl->AddValueObserver(&dummy_impl); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); gfx::ScrollOffset initial_value(100.f, 300.f); gfx::ScrollOffset target_value(300.f, 200.f); @@ -934,8 +923,7 @@ TEST(LayerAnimationControllerTest, ScrollOffsetRemovalClearsScrollDelta) { LayerAnimationController::Create(0)); controller_impl->AddValueObserver(&dummy_impl); controller_impl->set_value_provider(&dummy_provider_impl); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; FakeLayerAnimationValueProvider dummy_provider; scoped_refptr<LayerAnimationController> controller( @@ -1065,8 +1053,7 @@ TEST(LayerAnimationControllerTest, scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); controller_impl->AddValueObserver(&dummy_impl); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeAnimationDelegate delegate; controller_impl->set_layer_animation_delegate(&delegate); @@ -1085,7 +1072,7 @@ TEST(LayerAnimationControllerTest, EXPECT_TRUE(delegate.started()); EXPECT_FALSE(delegate.finished()); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); controller_impl->UpdateState(true, events.get()); @@ -1121,13 +1108,13 @@ TEST(LayerAnimationControllerTest, EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY, controller_impl->GetAnimationById(animation_id)->run_state()); - AnimationEventsVector events; + AnimationEvents events; controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, &events); // Synchronize the start times. - EXPECT_EQ(1u, events.size()); - controller->NotifyAnimationStarted(events[0]); + EXPECT_EQ(1u, events.events_.size()); + controller->NotifyAnimationStarted(events.events_[0]); // Validate start time on the main thread delegate. EXPECT_EQ(start_time, delegate.start_time()); @@ -1173,13 +1160,13 @@ TEST(LayerAnimationControllerTest, SpecifiedStartTimesAreSentToEventObservers) { EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY, controller_impl->GetAnimationById(animation_id)->run_state()); - AnimationEventsVector events; + AnimationEvents events; controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, &events); // Synchronize the start times. - EXPECT_EQ(1u, events.size()); - controller->NotifyAnimationStarted(events[0]); + EXPECT_EQ(1u, events.events_.size()); + controller->NotifyAnimationStarted(events.events_[0]); // Validate start time on the event observer. EXPECT_EQ(start_time, observer.start_time()); @@ -1189,8 +1176,7 @@ TEST(LayerAnimationControllerTest, SpecifiedStartTimesAreSentToEventObservers) { // finish. TEST(LayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyOutwaitTheirFinish) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1229,8 +1215,7 @@ TEST(LayerAnimationControllerTest, // Tests that two queued animations affecting the same property run in sequence. TEST(LayerAnimationControllerTest, TrivialQueuing) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1271,8 +1256,7 @@ TEST(LayerAnimationControllerTest, TrivialQueuing) { // Tests interrupting a transition with another transition. TEST(LayerAnimationControllerTest, Interrupt) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1306,8 +1290,7 @@ TEST(LayerAnimationControllerTest, Interrupt) { // Tests scheduling two animations to run together when only one property is // free. TEST(LayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1343,8 +1326,7 @@ TEST(LayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked) { // another animation queued to start when the shorter animation finishes (should // wait for both to finish). TEST(LayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1384,8 +1366,7 @@ TEST(LayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting) { // Test that a looping animation loops and for the correct number of iterations. TEST(LayerAnimationControllerTest, TrivialLooping) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1430,8 +1411,7 @@ TEST(LayerAnimationControllerTest, TrivialLooping) { // Test that an infinitely looping animation does indeed go until aborted. TEST(LayerAnimationControllerTest, InfiniteLooping) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1477,8 +1457,7 @@ TEST(LayerAnimationControllerTest, InfiniteLooping) { // Test that pausing and resuming work as expected. TEST(LayerAnimationControllerTest, PauseResume) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1523,8 +1502,7 @@ TEST(LayerAnimationControllerTest, PauseResume) { } TEST(LayerAnimationControllerTest, AbortAGroupedAnimation) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1569,8 +1547,7 @@ TEST(LayerAnimationControllerTest, PushUpdatesWhenSynchronizedStartTimeNeeded) { scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); controller_impl->AddValueObserver(&dummy_impl); - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1600,8 +1577,7 @@ TEST(LayerAnimationControllerTest, PushUpdatesWhenSynchronizedStartTimeNeeded) { // Tests that skipping a call to UpdateState works as expected. TEST(LayerAnimationControllerTest, SkipUpdateState) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; scoped_refptr<LayerAnimationController> controller( LayerAnimationController::Create(0)); @@ -1626,12 +1602,12 @@ TEST(LayerAnimationControllerTest, SkipUpdateState) { controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000)); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller->UpdateState(true, events.get()); // Should have one STARTED event and one FINISHED event. - EXPECT_EQ(2u, events->size()); - EXPECT_NE((*events)[0].type, (*events)[1].type); + EXPECT_EQ(2u, events->events_.size()); + EXPECT_NE(events->events_[0].type, events->events_[1].type); // The float transition should still be at its starting point. EXPECT_TRUE(controller->HasActiveAnimation()); @@ -1648,8 +1624,7 @@ TEST(LayerAnimationControllerTest, SkipUpdateState) { // Tests that an animation controller with only a pending observer gets ticked // but doesn't progress animations past the STARTING state. TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy; FakeInactiveLayerAnimationValueObserver pending_dummy; scoped_refptr<LayerAnimationController> controller( @@ -1664,7 +1639,7 @@ TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) { // state. controller->Animate(kInitialTickTime); controller->UpdateState(true, events.get()); - EXPECT_EQ(0u, events->size()); + EXPECT_EQ(0u, events->events_.size()); EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY, controller->GetAnimation(Animation::OPACITY)->run_state()); @@ -1675,7 +1650,7 @@ TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) { // progress to RUNNING. controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); controller->UpdateState(true, events.get()); - EXPECT_EQ(0u, events->size()); + EXPECT_EQ(0u, events->events_.size()); EXPECT_EQ(Animation::STARTING, controller->GetAnimation(Animation::OPACITY)->run_state()); EXPECT_EQ(0.5f, pending_dummy.opacity()); @@ -1684,7 +1659,7 @@ TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) { // there, and shouldn't be ticked past its starting point. controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000)); controller->UpdateState(true, events.get()); - EXPECT_EQ(0u, events->size()); + EXPECT_EQ(0u, events->events_.size()); EXPECT_EQ(Animation::STARTING, controller->GetAnimation(Animation::OPACITY)->run_state()); EXPECT_EQ(0.5f, pending_dummy.opacity()); @@ -1695,7 +1670,7 @@ TEST(LayerAnimationControllerTest, InactiveObserverGetsTicked) { // initially tick at its starting point, but should now progress to RUNNING. controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000)); controller->UpdateState(true, events.get()); - EXPECT_EQ(1u, events->size()); + EXPECT_EQ(1u, events->events_.size()); EXPECT_EQ(Animation::RUNNING, controller->GetAnimation(Animation::OPACITY)->run_state()); EXPECT_EQ(0.5f, pending_dummy.opacity()); @@ -1882,16 +1857,16 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) { EXPECT_FALSE(dummy.animation_waiting_for_deletion()); EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion()); - AnimationEventsVector events; + AnimationEvents events; controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, &events); EXPECT_TRUE(dummy_impl.animation_waiting_for_deletion()); - EXPECT_EQ(1u, events.size()); - EXPECT_EQ(AnimationEvent::ABORTED, events[0].type); + EXPECT_EQ(1u, events.events_.size()); + EXPECT_EQ(AnimationEvent::ABORTED, events.events_[0].type); EXPECT_EQ(Animation::WAITING_FOR_DELETION, controller_impl->GetAnimation(Animation::OPACITY)->run_state()); - controller->NotifyAnimationAborted(events[0]); + controller->NotifyAnimationAborted(events.events_[0]); EXPECT_EQ(Animation::ABORTED, controller->GetAnimation(Animation::OPACITY)->run_state()); @@ -1910,8 +1885,7 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) { // Ensure that we only generate FINISHED events for animations in a group // once all animations in that group are finished. TEST(LayerAnimationControllerTest, FinishedEventsForGroup) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); @@ -1936,18 +1910,18 @@ TEST(LayerAnimationControllerTest, FinishedEventsForGroup) { controller_impl->UpdateState(true, events.get()); // Both animations should have started. - EXPECT_EQ(2u, events->size()); - EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type); - EXPECT_EQ(AnimationEvent::STARTED, (*events)[1].type); + EXPECT_EQ(2u, events->events_.size()); + EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type); + EXPECT_EQ(AnimationEvent::STARTED, events->events_[1].type); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); controller_impl->UpdateState(true, events.get()); // The opacity animation should be finished, but should not have generated // a FINISHED event yet. - EXPECT_EQ(0u, events->size()); + EXPECT_EQ(0u, events->events_.size()); EXPECT_EQ(Animation::FINISHED, controller_impl->GetAnimationById(2)->run_state()); EXPECT_EQ(Animation::RUNNING, @@ -1958,17 +1932,16 @@ TEST(LayerAnimationControllerTest, FinishedEventsForGroup) { controller_impl->UpdateState(true, events.get()); // Both animations should have generated FINISHED events. - EXPECT_EQ(2u, events->size()); - EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type); - EXPECT_EQ(AnimationEvent::FINISHED, (*events)[1].type); + EXPECT_EQ(2u, events->events_.size()); + EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type); + EXPECT_EQ(AnimationEvent::FINISHED, events->events_[1].type); } // Ensure that when a group has a mix of aborted and finished animations, // we generate a FINISHED event for the finished animation and an ABORTED // event for the aborted animation. TEST(LayerAnimationControllerTest, FinishedAndAbortedEventsForGroup) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); @@ -1991,24 +1964,24 @@ TEST(LayerAnimationControllerTest, FinishedAndAbortedEventsForGroup) { controller_impl->UpdateState(true, events.get()); // Both animations should have started. - EXPECT_EQ(2u, events->size()); - EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type); - EXPECT_EQ(AnimationEvent::STARTED, (*events)[1].type); + EXPECT_EQ(2u, events->events_.size()); + EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type); + EXPECT_EQ(AnimationEvent::STARTED, events->events_[1].type); controller_impl->AbortAnimations(Animation::OPACITY); - events.reset(new AnimationEventsVector); + events.reset(new AnimationEvents); controller_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); controller_impl->UpdateState(true, events.get()); // We should have exactly 2 events: a FINISHED event for the tranform // animation, and an ABORTED event for the opacity animation. - EXPECT_EQ(2u, events->size()); - EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type); - EXPECT_EQ(Animation::TRANSFORM, (*events)[0].target_property); - EXPECT_EQ(AnimationEvent::ABORTED, (*events)[1].type); - EXPECT_EQ(Animation::OPACITY, (*events)[1].target_property); + EXPECT_EQ(2u, events->events_.size()); + EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type); + EXPECT_EQ(Animation::TRANSFORM, events->events_[0].target_property); + EXPECT_EQ(AnimationEvent::ABORTED, events->events_[1].type); + EXPECT_EQ(Animation::OPACITY, events->events_[1].target_property); } TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) { @@ -2453,8 +2426,7 @@ TEST(LayerAnimationControllerTest, MaximumTargetScaleWithDirection) { } TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; FakeInactiveLayerAnimationValueObserver pending_dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( @@ -2516,8 +2488,7 @@ TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) { } TEST(LayerAnimationControllerTest, ActivationBetweenAnimateAndUpdateState) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; FakeInactiveLayerAnimationValueObserver pending_dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( @@ -2571,7 +2542,7 @@ TEST(LayerAnimationControllerTest, ActivationBetweenAnimateAndUpdateState) { TEST(LayerAnimationControllerTest, ObserverNotifiedWhenTransformIsPotentiallyAnimatingChanges) { - AnimationEventsVector events; + AnimationEvents events; FakeLayerAnimationValueObserver active_dummy_impl; FakeInactiveLayerAnimationValueObserver pending_dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( @@ -2602,8 +2573,8 @@ TEST(LayerAnimationControllerTest, controller_impl->Animate(kInitialTickTime); controller_impl->UpdateState(true, &events); - controller->NotifyAnimationStarted(events[0]); - events.clear(); + controller->NotifyAnimationStarted(events.events_[0]); + events.events_.clear(); // Finish the animation. controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000)); @@ -2622,8 +2593,8 @@ TEST(LayerAnimationControllerTest, EXPECT_FALSE(pending_dummy_impl.transform_is_animating()); EXPECT_FALSE(active_dummy_impl.transform_is_animating()); - controller->NotifyAnimationFinished(events[0]); - events.clear(); + controller->NotifyAnimationFinished(events.events_[0]); + events.events_.clear(); // Case 2: An animation that's removed before it finishes. int animation_id = @@ -2642,8 +2613,8 @@ TEST(LayerAnimationControllerTest, TimeDelta::FromMilliseconds(2000)); controller_impl->UpdateState(true, &events); - controller->NotifyAnimationStarted(events[0]); - events.clear(); + controller->NotifyAnimationStarted(events.events_[0]); + events.events_.clear(); controller->RemoveAnimation(animation_id); EXPECT_FALSE(dummy.transform_is_animating()); @@ -2672,8 +2643,8 @@ TEST(LayerAnimationControllerTest, TimeDelta::FromMilliseconds(3000)); controller_impl->UpdateState(true, &events); - controller->NotifyAnimationStarted(events[0]); - events.clear(); + controller->NotifyAnimationStarted(events.events_[0]); + events.events_.clear(); controller_impl->AbortAnimations(Animation::TRANSFORM); EXPECT_FALSE(pending_dummy_impl.transform_is_animating()); @@ -2683,7 +2654,7 @@ TEST(LayerAnimationControllerTest, TimeDelta::FromMilliseconds(4000)); controller_impl->UpdateState(true, &events); - controller->NotifyAnimationAborted(events[0]); + controller->NotifyAnimationAborted(events.events_[0]); EXPECT_FALSE(dummy.transform_is_animating()); } @@ -2720,8 +2691,7 @@ TEST(LayerAnimationControllerTest, ClippedNegativeOpacityValues) { } TEST(LayerAnimationControllerTest, PushedDeletedAnimationWaitsForActivation) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; FakeInactiveLayerAnimationValueObserver pending_dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( @@ -2777,8 +2747,7 @@ TEST(LayerAnimationControllerTest, PushedDeletedAnimationWaitsForActivation) { // Tests that an animation that affects only active observers won't block // an animation that affects only pending observers from starting. TEST(LayerAnimationControllerTest, StartAnimationsAffectingDifferentObservers) { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); FakeLayerAnimationValueObserver dummy_impl; FakeInactiveLayerAnimationValueObserver pending_dummy_impl; scoped_refptr<LayerAnimationController> controller_impl( diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 9fa2731..238c234 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -16,7 +16,6 @@ #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "cc/animation/animation.h" -#include "cc/animation/animation_events.h" #include "cc/animation/animation_registrar.h" #include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/layer_animation_controller.h" diff --git a/cc/test/animation_timelines_test_common.cc b/cc/test/animation_timelines_test_common.cc index 1d0d489..46d9d53 100644 --- a/cc/test/animation_timelines_test_common.cc +++ b/cc/test/animation_timelines_test_common.cc @@ -235,12 +235,12 @@ void AnimationTimelinesTest::ReleaseRefPtrs() { void AnimationTimelinesTest::AnimateLayersTransferEvents( base::TimeTicks time, unsigned expect_events) { - scoped_ptr<AnimationEventsVector> events = + scoped_ptr<AnimationEvents> events = host_->animation_registrar()->CreateEvents(); host_impl_->animation_registrar()->AnimateLayers(time); host_impl_->animation_registrar()->UpdateAnimationState(true, events.get()); - EXPECT_EQ(expect_events, events->size()); + EXPECT_EQ(expect_events, events->events_.size()); host_->animation_registrar()->AnimateLayers(time); host_->animation_registrar()->UpdateAnimationState(true, nullptr); diff --git a/cc/test/fake_channel_impl.cc b/cc/test/fake_channel_impl.cc index 8b609d4..7d14a70 100644 --- a/cc/test/fake_channel_impl.cc +++ b/cc/test/fake_channel_impl.cc @@ -2,10 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "cc/animation/animation_events.h" #include "cc/test/fake_channel_impl.h" namespace cc { FakeChannelImpl::FakeChannelImpl() {} +void FakeChannelImpl::SetAnimationEvents(scoped_ptr<AnimationEvents> queue) {} + } // namespace cc diff --git a/cc/test/fake_channel_impl.h b/cc/test/fake_channel_impl.h index 32716ea..179cbc5 100644 --- a/cc/test/fake_channel_impl.h +++ b/cc/test/fake_channel_impl.h @@ -21,7 +21,7 @@ class FakeChannelImpl : public ChannelImpl { const RendererCapabilities& capabilities) override {} void BeginMainFrameNotExpectedSoon() override {} void DidCommitAndDrawFrame() override {} - void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) override {} + void SetAnimationEvents(scoped_ptr<AnimationEvents> queue) override; void DidLoseOutputSurface() override {} void RequestNewOutputSurface() override {} void DidInitializeOutputSurface( diff --git a/cc/test/fake_layer_tree_host_impl_client.cc b/cc/test/fake_layer_tree_host_impl_client.cc index e8e382d..29a4d83 100644 --- a/cc/test/fake_layer_tree_host_impl_client.cc +++ b/cc/test/fake_layer_tree_host_impl_client.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "cc/animation/animation_events.h" #include "cc/test/fake_layer_tree_host_impl_client.h" namespace cc { @@ -10,4 +11,7 @@ bool FakeLayerTreeHostImplClient::IsInsideDraw() { return false; } +void FakeLayerTreeHostImplClient::PostAnimationEventsToMainThreadOnImplThread( + scoped_ptr<AnimationEvents> events) {} + } // namespace cc diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h index 22795c8..cf2525b 100644 --- a/cc/test/fake_layer_tree_host_impl_client.h +++ b/cc/test/fake_layer_tree_host_impl_client.h @@ -31,7 +31,7 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient { void SetNeedsPrepareTilesOnImplThread() override {} void SetVideoNeedsBeginFrames(bool needs_begin_frames) override {} void PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> events) override {} + scoped_ptr<AnimationEvents> events) override; bool IsInsideDraw() override; void RenewTreePriority() override {} void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, diff --git a/cc/test/proxy_main_for_test.cc b/cc/test/proxy_main_for_test.cc index dcac9a0..f0130d6 100644 --- a/cc/test/proxy_main_for_test.cc +++ b/cc/test/proxy_main_for_test.cc @@ -4,6 +4,7 @@ #include "cc/test/proxy_main_for_test.h" +#include "cc/animation/animation_events.h" #include "cc/test/threaded_channel_for_test.h" namespace cc { @@ -52,8 +53,7 @@ void ProxyMainForTest::DidCommitAndDrawFrame() { ProxyMain::DidCommitAndDrawFrame(); } -void ProxyMainForTest::SetAnimationEvents( - scoped_ptr<AnimationEventsVector> events) { +void ProxyMainForTest::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { test_hooks_->ReceivedSetAnimationEvents(); ProxyMain::SetAnimationEvents(std::move(events)); } diff --git a/cc/test/proxy_main_for_test.h b/cc/test/proxy_main_for_test.h index 5631701..42f8a95 100644 --- a/cc/test/proxy_main_for_test.h +++ b/cc/test/proxy_main_for_test.h @@ -32,7 +32,7 @@ class ProxyMainForTest : public ProxyMain { const RendererCapabilities& capabilities) override; void BeginMainFrameNotExpectedSoon() override; void DidCommitAndDrawFrame() override; - void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) override; + void SetAnimationEvents(scoped_ptr<AnimationEvents> events) override; void DidLoseOutputSurface() override; void RequestNewOutputSurface() override; void DidInitializeOutputSurface( diff --git a/cc/trees/channel_impl.h b/cc/trees/channel_impl.h index 2776116..d5d3159 100644 --- a/cc/trees/channel_impl.h +++ b/cc/trees/channel_impl.h @@ -5,7 +5,6 @@ #ifndef CC_TREES_CHANNEL_IMPL_H_ #define CC_TREES_CHANNEL_IMPL_H_ -#include "cc/animation/animation_events.h" #include "cc/base/cc_export.h" #include "cc/debug/frame_timing_tracker.h" #include "cc/output/renderer_capabilities.h" @@ -13,6 +12,8 @@ namespace cc { +class AnimationEvents; + // Channel used to send commands to and receive commands from ProxyMain. // The ChannelImpl implementation creates and owns ProxyImpl on receiving the // InitializeImpl call from ChannelMain. @@ -25,7 +26,7 @@ class CC_EXPORT ChannelImpl { const RendererCapabilities& capabilities) = 0; virtual void BeginMainFrameNotExpectedSoon() = 0; virtual void DidCommitAndDrawFrame() = 0; - virtual void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) = 0; + virtual void SetAnimationEvents(scoped_ptr<AnimationEvents> queue) = 0; virtual void DidLoseOutputSurface() = 0; virtual void RequestNewOutputSurface() = 0; virtual void DidInitializeOutputSurface( diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 686057e..5489dd4 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -23,6 +23,7 @@ #include "base/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" +#include "cc/animation/animation_events.h" #include "cc/animation/animation_host.h" #include "cc/animation/animation_registrar.h" #include "cc/animation/layer_animation_controller.h" @@ -576,8 +577,7 @@ void LayerTreeHost::SetNextCommitForcesRedraw() { proxy_->SetNeedsUpdateLayers(); } -void LayerTreeHost::SetAnimationEvents( - scoped_ptr<AnimationEventsVector> events) { +void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { DCHECK(task_runner_provider_->IsMainThread()); if (animation_host_) animation_host_->SetAnimationEvents(std::move(events)); @@ -945,16 +945,18 @@ void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { if (!settings_.accelerated_animation_enabled) return; - AnimationEventsVector events; + scoped_ptr<AnimationEvents> events; if (animation_host_) { + events = animation_host_->CreateEvents(); if (animation_host_->AnimateLayers(monotonic_time)) - animation_host_->UpdateAnimationState(true, &events); + animation_host_->UpdateAnimationState(true, events.get()); } else { + events = animation_registrar_->CreateEvents(); if (animation_registrar_->AnimateLayers(monotonic_time)) - animation_registrar_->UpdateAnimationState(true, &events); + animation_registrar_->UpdateAnimationState(true, events.get()); } - if (!events.empty()) + if (!events->events_.empty()) property_trees_.needs_rebuild = true; } diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index 9d196e1..d8eba8d 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -20,7 +20,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" -#include "cc/animation/animation_events.h" +#include "cc/animation/animation.h" #include "cc/base/cc_export.h" #include "cc/debug/frame_timing_tracker.h" #include "cc/debug/micro_benchmark.h" @@ -51,6 +51,8 @@ class GpuMemoryBufferManager; } namespace cc { + +class AnimationEvents; class AnimationRegistrar; class AnimationHost; class BeginFrameSource; @@ -183,7 +185,7 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient { void SetNextCommitForcesRedraw(); - void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); + void SetAnimationEvents(scoped_ptr<AnimationEvents> events); void SetRootLayer(scoped_refptr<Layer> root_layer); Layer* root_layer() { return root_layer_.get(); } diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 0d6ba6d..057228f 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -21,6 +21,7 @@ #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/trace_event/trace_event_argument.h" +#include "cc/animation/animation_events.h" #include "cc/animation/animation_host.h" #include "cc/animation/animation_id_provider.h" #include "cc/animation/scroll_offset_animation_curve.h" @@ -3267,7 +3268,7 @@ void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { return; bool has_active_animations = false; - scoped_ptr<AnimationEventsVector> events; + scoped_ptr<AnimationEvents> events; if (animation_host_) { events = animation_host_->CreateEvents(); @@ -3279,7 +3280,7 @@ void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { start_ready_animations, events.get()); } - if (!events->empty()) + if (!events->events_.empty()) client_->PostAnimationEventsToMainThreadOnImplThread(std::move(events)); if (has_active_animations) diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index b086d2d..6d78c16 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -15,7 +15,6 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" -#include "cc/animation/animation_events.h" #include "cc/animation/animation_registrar.h" #include "cc/animation/scrollbar_animation_controller.h" #include "cc/base/cc_export.h" @@ -51,6 +50,7 @@ class ScrollOffset; namespace cc { +class AnimationEvents; class AnimationHost; class CompletionEvent; class CompositorFrameMetadata; @@ -111,7 +111,7 @@ class LayerTreeHostImplClient { virtual void SetNeedsPrepareTilesOnImplThread() = 0; virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; virtual void PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> events) = 0; + scoped_ptr<AnimationEvents> events) = 0; virtual bool IsInsideDraw() = 0; virtual void RenewTreePriority() = 0; virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 8002046..814279e 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -16,6 +16,7 @@ #include "base/containers/scoped_ptr_hash_map.h" #include "base/location.h" #include "base/thread_task_runner_handle.h" +#include "cc/animation/animation_events.h" #include "cc/animation/animation_host.h" #include "cc/animation/animation_id_provider.h" #include "cc/animation/scrollbar_animation_controller_thinning.h" @@ -151,7 +152,7 @@ class LayerTreeHostImplTest : public testing::Test, void SetNeedsCommitOnImplThread() override { did_request_commit_ = true; } void SetVideoNeedsBeginFrames(bool needs_begin_frames) override {} void PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> events) override {} + scoped_ptr<AnimationEvents> events) override {} bool IsInsideDraw() override { return false; } void RenewTreePriority() override {} void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc index 9a779ea..f9a1eab 100644 --- a/cc/trees/proxy_impl.cc +++ b/cc/trees/proxy_impl.cc @@ -11,6 +11,7 @@ #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" #include "base/trace_event/trace_event_synthetic_delay.h" +#include "cc/animation/animation_events.h" #include "cc/debug/benchmark_instrumentation.h" #include "cc/debug/devtools_instrumentation.h" #include "cc/input/top_controls_manager.h" @@ -357,7 +358,7 @@ void ProxyImpl::SetVideoNeedsBeginFrames(bool needs_begin_frames) { } void ProxyImpl::PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> events) { + scoped_ptr<AnimationEvents> events) { TRACE_EVENT0("cc", "ProxyImpl::PostAnimationEventsToMainThreadOnImplThread"); DCHECK(IsImplThread()); channel_impl_->SetAnimationEvents(std::move(events)); diff --git a/cc/trees/proxy_impl.h b/cc/trees/proxy_impl.h index 3dd2265..3839904 100644 --- a/cc/trees/proxy_impl.h +++ b/cc/trees/proxy_impl.h @@ -95,7 +95,7 @@ class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), void SetNeedsCommitOnImplThread() override; void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; void PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> queue) override; + scoped_ptr<AnimationEvents> events) override; bool IsInsideDraw() override; void RenewTreePriority() override; void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc index 1b06367..2175e7f 100644 --- a/cc/trees/proxy_main.cc +++ b/cc/trees/proxy_main.cc @@ -10,6 +10,7 @@ #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" #include "base/trace_event/trace_event_synthetic_delay.h" +#include "cc/animation/animation_events.h" #include "cc/debug/benchmark_instrumentation.h" #include "cc/debug/devtools_instrumentation.h" #include "cc/output/output_surface.h" @@ -80,7 +81,7 @@ void ProxyMain::DidCommitAndDrawFrame() { layer_tree_host_->DidCommitAndDrawFrame(); } -void ProxyMain::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) { +void ProxyMain::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents"); DCHECK(IsMainThread()); layer_tree_host_->SetAnimationEvents(std::move(events)); diff --git a/cc/trees/proxy_main.h b/cc/trees/proxy_main.h index bb510b8..b7d5d1b 100644 --- a/cc/trees/proxy_main.h +++ b/cc/trees/proxy_main.h @@ -6,7 +6,6 @@ #define CC_TREES_PROXY_MAIN_H_ #include "base/macros.h" -#include "cc/animation/animation_events.h" #include "cc/base/cc_export.h" #include "cc/debug/frame_timing_tracker.h" #include "cc/input/top_controls_state.h" @@ -17,6 +16,8 @@ #include "cc/trees/proxy_common.h" namespace cc { + +class AnimationEvents; class BeginFrameSource; class ChannelMain; class LayerTreeHost; @@ -48,7 +49,7 @@ class CC_EXPORT ProxyMain : public Proxy { const RendererCapabilities& capabilities); virtual void BeginMainFrameNotExpectedSoon(); virtual void DidCommitAndDrawFrame(); - virtual void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue); + virtual void SetAnimationEvents(scoped_ptr<AnimationEvents> events); virtual void DidLoseOutputSurface(); virtual void RequestNewOutputSurface(); virtual void DidInitializeOutputSurface( diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 1f08b89..6e73dfa 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -7,6 +7,7 @@ #include "base/auto_reset.h" #include "base/profiler/scoped_tracker.h" #include "base/trace_event/trace_event.h" +#include "cc/animation/animation_events.h" #include "cc/debug/benchmark_instrumentation.h" #include "cc/debug/devtools_instrumentation.h" #include "cc/output/context_provider.h" @@ -415,7 +416,7 @@ void SingleThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { } void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> events) { + scoped_ptr<AnimationEvents> events) { TRACE_EVENT0( "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); DCHECK(task_runner_provider_->IsImplThread()); diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index ec82b70..099c223 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -10,7 +10,6 @@ #include "base/cancelable_callback.h" #include "base/macros.h" #include "base/time/time.h" -#include "cc/animation/animation_events.h" #include "cc/output/begin_frame_args.h" #include "cc/scheduler/scheduler.h" #include "cc/trees/blocking_task_runner.h" @@ -20,6 +19,7 @@ namespace cc { +class AnimationEvents; class BeginFrameSource; class ContextProvider; class LayerTreeHost; @@ -95,7 +95,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy, void SetNeedsCommitOnImplThread() override; void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; void PostAnimationEventsToMainThreadOnImplThread( - scoped_ptr<AnimationEventsVector> events) override; + scoped_ptr<AnimationEvents> events) override; bool IsInsideDraw() override; void RenewTreePriority() override {} void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, diff --git a/cc/trees/threaded_channel.cc b/cc/trees/threaded_channel.cc index 3d2eb33..07b17cb 100644 --- a/cc/trees/threaded_channel.cc +++ b/cc/trees/threaded_channel.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/single_thread_task_runner.h" #include "base/trace_event/trace_event.h" +#include "cc/animation/animation_events.h" #include "cc/trees/layer_tree_host.h" namespace cc { @@ -214,12 +215,11 @@ void ThreadedChannel::DidCommitAndDrawFrame() { impl().proxy_main_weak_ptr)); } -void ThreadedChannel::SetAnimationEvents( - scoped_ptr<AnimationEventsVector> queue) { +void ThreadedChannel::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { DCHECK(IsImplThread()); MainThreadTaskRunner()->PostTask( FROM_HERE, base::Bind(&ProxyMain::SetAnimationEvents, - impl().proxy_main_weak_ptr, base::Passed(&queue))); + impl().proxy_main_weak_ptr, base::Passed(&events))); } void ThreadedChannel::DidLoseOutputSurface() { diff --git a/cc/trees/threaded_channel.h b/cc/trees/threaded_channel.h index 71d2c54..ebc064c 100644 --- a/cc/trees/threaded_channel.h +++ b/cc/trees/threaded_channel.h @@ -119,7 +119,7 @@ class CC_EXPORT ThreadedChannel : public ChannelMain, public ChannelImpl { const RendererCapabilities& capabilities) override; void BeginMainFrameNotExpectedSoon() override; void DidCommitAndDrawFrame() override; - void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) override; + void SetAnimationEvents(scoped_ptr<AnimationEvents> events) override; void DidLoseOutputSurface() override; void RequestNewOutputSurface() override; void DidInitializeOutputSurface( diff --git a/cc/trees/threaded_channel_unittest.cc b/cc/trees/threaded_channel_unittest.cc index 359a7f9..79d1c65 100644 --- a/cc/trees/threaded_channel_unittest.cc +++ b/cc/trees/threaded_channel_unittest.cc @@ -5,6 +5,7 @@ #include "cc/trees/threaded_channel.h" #include "base/macros.h" +#include "cc/animation/animation_events.h" #include "cc/test/layer_tree_test.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gtest/include/gtest/gtest.h" @@ -258,8 +259,7 @@ class ThreadedChannelTestSetAnimationEvents : public ThreadedChannelTest { void BeginChannelTest() override { PostOnImplThread(); } void StartTestOnImplThread() override { - scoped_ptr<AnimationEventsVector> events( - make_scoped_ptr(new AnimationEventsVector)); + scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents)); GetProxyImplForTest()->PostAnimationEventsToMainThreadOnImplThread( std::move(events)); } |