CC Animation: Erase LayerAnimationEventObserver.
Use AnimatiodDelegate in ui::LayerAnimator instead.
BUG=595571
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1898683002
Cr-Commit-Position: refs/heads/master@{#388082}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index ffe865f..fae8e87 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -28,7 +28,6 @@
"animation/keyframed_animation_curve.h",
"animation/layer_animation_controller.cc",
"animation/layer_animation_controller.h",
- "animation/layer_animation_event_observer.h",
"animation/layer_animation_value_observer.h",
"animation/layer_animation_value_provider.h",
"animation/scroll_offset_animation_curve.cc",
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc
index 8b07e4e..6cf9ea3 100644
--- a/cc/animation/element_animations.cc
+++ b/cc/animation/element_animations.cc
@@ -143,11 +143,6 @@
return layer_animation_controller_->GetAnimationById(animation_id);
}
-void ElementAnimations::SetEventObserver(
- LayerAnimationEventObserver* observer) {
- layer_animation_controller_->SetEventObserver(observer);
-}
-
void ElementAnimations::OnFilterAnimated(LayerTreeType tree_type,
const FilterOperations& filters) {
DCHECK(layer_id());
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h
index 72051e3..4214f317 100644
--- a/cc/animation/element_animations.h
+++ b/cc/animation/element_animations.h
@@ -90,8 +90,6 @@
// Returns the active animation for the given unique animation id.
Animation* GetAnimationById(int animation_id) const;
- void SetEventObserver(LayerAnimationEventObserver* observer);
-
private:
friend class base::RefCounted<ElementAnimations>;
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index c722dc59..21a88508 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -28,7 +28,6 @@
: host_(0),
id_(id),
is_active_(false),
- event_observer_(nullptr),
value_observer_(nullptr),
value_provider_(nullptr),
layer_animation_delegate_(nullptr),
@@ -391,8 +390,6 @@
void LayerAnimationController::NotifyAnimationStarted(
const AnimationEvent& event) {
if (event.is_impl_only) {
- if (event_observer_)
- event_observer_->OnAnimationStarted(event);
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationStarted(
event.monotonic_time, event.target_property, event.group_id);
@@ -407,8 +404,6 @@
if (!animations_[i]->has_set_start_time())
animations_[i]->set_start_time(event.monotonic_time);
- if (event_observer_)
- event_observer_->OnAnimationStarted(event);
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationStarted(
event.monotonic_time, event.target_property, event.group_id);
@@ -489,11 +484,6 @@
}
}
-void LayerAnimationController::SetEventObserver(
- LayerAnimationEventObserver* observer) {
- event_observer_ = observer;
-}
-
bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (!animations_[i]->is_finished() &&
diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h
index 24f5bc80..8dd1f51 100644
--- a/cc/animation/layer_animation_controller.h
+++ b/cc/animation/layer_animation_controller.h
@@ -13,7 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "cc/animation/animation.h"
-#include "cc/animation/layer_animation_event_observer.h"
+#include "cc/animation/animation_events.h"
#include "cc/animation/target_property.h"
#include "cc/base/cc_export.h"
#include "ui/gfx/geometry/scroll_offset.h"
@@ -120,8 +120,6 @@
needs_pending_value_observations_ = needs_pending_value_observations;
}
- void SetEventObserver(LayerAnimationEventObserver* observer);
-
void set_value_provider(LayerAnimationValueProvider* provider) {
value_provider_ = provider;
}
@@ -249,7 +247,6 @@
base::TimeTicks last_tick_time_;
- LayerAnimationEventObserver* event_observer_;
LayerAnimationValueObserver* value_observer_;
LayerAnimationValueProvider* value_provider_;
AnimationDelegate* layer_animation_delegate_;
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index 3f946c3..095ed3a8 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -1208,64 +1208,6 @@
EXPECT_EQ(start_time, delegate.start_time());
}
-class FakeLayerAnimationEventObserver : public LayerAnimationEventObserver {
- public:
- FakeLayerAnimationEventObserver() : start_time_(base::TimeTicks()) {}
-
- void OnAnimationStarted(const AnimationEvent& event) override {
- start_time_ = event.monotonic_time;
- }
-
- TimeTicks start_time() { return start_time_; }
-
- private:
- TimeTicks start_time_;
-};
-
-// Tests that specified start times are sent to the event observers
-TEST(LayerAnimationControllerTest, SpecifiedStartTimesAreSentToEventObservers) {
- FakeLayerAnimationValueObserver dummy_impl;
- scoped_refptr<LayerAnimationController> controller_impl(
- LayerAnimationController::Create(0));
- controller_impl->set_value_observer(&dummy_impl);
- controller_impl->set_needs_active_value_observations(true);
-
- FakeLayerAnimationValueObserver dummy;
- scoped_refptr<LayerAnimationController> controller(
- LayerAnimationController::Create(0));
- controller->set_value_observer(&dummy);
- controller->set_needs_active_value_observations(true);
-
- FakeLayerAnimationEventObserver observer;
- controller->SetEventObserver(&observer);
-
- int animation_id =
- AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
-
- const TimeTicks start_time = TicksFromSecondsF(123);
- controller->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
-
- controller->PushAnimationUpdatesTo(controller_impl.get());
- controller_impl->ActivateAnimations();
-
- EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
- controller_impl->GetAnimationById(animation_id)->run_state());
-
- AnimationEvents events;
- controller_impl->Animate(kInitialTickTime);
- controller_impl->UpdateState(true, &events);
-
- // Synchronize the start times.
- 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());
-
- controller->SetEventObserver(nullptr);
-}
-
// Tests animations that are waiting for a synchronized start time do not
// finish.
TEST(LayerAnimationControllerTest,
diff --git a/cc/animation/layer_animation_event_observer.h b/cc/animation/layer_animation_event_observer.h
deleted file mode 100644
index 93d606e..0000000
--- a/cc/animation/layer_animation_event_observer.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_ANIMATION_LAYER_ANIMATION_EVENT_OBSERVER_H_
-#define CC_ANIMATION_LAYER_ANIMATION_EVENT_OBSERVER_H_
-
-#include "cc/base/cc_export.h"
-
-namespace cc {
-
-struct AnimationEvent;
-
-class CC_EXPORT LayerAnimationEventObserver {
- public:
- virtual void OnAnimationStarted(const AnimationEvent& event) = 0;
-
- protected:
- virtual ~LayerAnimationEventObserver() {}
-};
-
-} // namespace cc
-
-#endif // CC_ANIMATION_LAYER_ANIMATION_EVENT_OBSERVER_H_
-
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 3c735ca..7b29a6e 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -56,7 +56,6 @@
'animation/keyframed_animation_curve.h',
'animation/layer_animation_controller.cc',
'animation/layer_animation_controller.h',
- 'animation/layer_animation_event_observer.h',
'animation/layer_animation_value_observer.h',
'animation/layer_animation_value_provider.h',
'animation/scroll_offset_animation_curve.cc',
diff --git a/ui/compositor/layer_animation_sequence.cc b/ui/compositor/layer_animation_sequence.cc
index f71728d..041bdbe 100644
--- a/ui/compositor/layer_animation_sequence.cc
+++ b/ui/compositor/layer_animation_sequence.cc
@@ -212,17 +212,19 @@
}
void LayerAnimationSequence::OnThreadedAnimationStarted(
- const cc::AnimationEvent& event) {
- if (elements_.empty() || event.group_id != animation_group_id_)
+ base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id) {
+ if (elements_.empty() || group_id != animation_group_id_)
return;
size_t current_index = last_element_ % elements_.size();
LayerAnimationElement::AnimatableProperties element_properties =
elements_[current_index]->properties();
LayerAnimationElement::AnimatableProperty event_property =
- LayerAnimationElement::ToAnimatableProperty(event.target_property);
+ LayerAnimationElement::ToAnimatableProperty(target_property);
DCHECK(element_properties & event_property);
- elements_[current_index]->set_effective_start_time(event.monotonic_time);
+ elements_[current_index]->set_effective_start_time(monotonic_time);
}
void LayerAnimationSequence::OnScheduled() {
diff --git a/ui/compositor/layer_animation_sequence.h b/ui/compositor/layer_animation_sequence.h
index 1cd1a9f..e050439 100644
--- a/ui/compositor/layer_animation_sequence.h
+++ b/ui/compositor/layer_animation_sequence.h
@@ -18,10 +18,6 @@
#include "ui/compositor/compositor_export.h"
#include "ui/compositor/layer_animation_element.h"
-namespace cc {
-struct AnimationEvent;
-}
-
namespace ui {
class LayerAnimationDelegate;
@@ -120,7 +116,9 @@
void RemoveObserver(LayerAnimationObserver* observer);
// Called when a threaded animation is actually started.
- void OnThreadedAnimationStarted(const cc::AnimationEvent& event);
+ void OnThreadedAnimationStarted(base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id);
// Called when the animator schedules this sequence.
void OnScheduled();
diff --git a/ui/compositor/layer_animation_sequence_unittest.cc b/ui/compositor/layer_animation_sequence_unittest.cc
index b4ec02b..9222046f 100644
--- a/ui/compositor/layer_animation_sequence_unittest.cc
+++ b/ui/compositor/layer_animation_sequence_unittest.cc
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "base/time/time.h"
-#include "cc/animation/animation_events.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/layer_animation_delegate.h"
#include "ui/compositor/layer_animation_element.h"
@@ -93,9 +92,9 @@
sequence.Progress(start_time, &delegate);
EXPECT_FLOAT_EQ(start, sequence.last_progressed_fraction());
effective_start = start_time + delta;
- sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ sequence.OnThreadedAnimationStarted(effective_start,
+ cc::TargetProperty::OPACITY,
+ sequence.animation_group_id());
sequence.Progress(effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(middle, sequence.last_progressed_fraction());
EXPECT_TRUE(sequence.IsFinished(effective_start + delta));
@@ -147,9 +146,9 @@
EXPECT_FLOAT_EQ(0.0, sequence.last_progressed_fraction());
opacity_effective_start = start_time + delta;
EXPECT_EQ(starting_group_id, sequence.animation_group_id());
- sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
- cc::TargetProperty::OPACITY, opacity_effective_start));
+ sequence.OnThreadedAnimationStarted(opacity_effective_start,
+ cc::TargetProperty::OPACITY,
+ sequence.animation_group_id());
sequence.Progress(opacity_effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction());
sequence.Progress(opacity_effective_start + delta, &delegate);
@@ -175,9 +174,9 @@
EXPECT_FLOAT_EQ(0.0, sequence.last_progressed_fraction());
transform_effective_start = opacity_effective_start + 3 * delta;
EXPECT_NE(starting_group_id, sequence.animation_group_id());
- sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
- cc::TargetProperty::TRANSFORM, transform_effective_start));
+ sequence.OnThreadedAnimationStarted(transform_effective_start,
+ cc::TargetProperty::TRANSFORM,
+ sequence.animation_group_id());
sequence.Progress(transform_effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction());
EXPECT_TRUE(sequence.IsFinished(transform_effective_start + delta));
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index 113e4d0a..d7c36da 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
-#include "cc/animation/animation_events.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_id_provider.h"
#include "cc/animation/animation_player.h"
@@ -196,13 +195,11 @@
else
DCHECK_EQ(animation_player_->layer_id(), layer_id);
- if (animation_player_->element_animations())
- animation_player_->element_animations()->SetEventObserver(this);
+ animation_player_->set_layer_animation_delegate(this);
}
void LayerAnimator::DetachLayerFromAnimationPlayer() {
- if (animation_player_->element_animations())
- animation_player_->element_animations()->SetEventObserver(nullptr);
+ animation_player_->set_layer_animation_delegate(nullptr);
if (animation_player_->layer_id())
animation_player_->DetachLayer();
@@ -405,23 +402,26 @@
}
void LayerAnimator::OnThreadedAnimationStarted(
- const cc::AnimationEvent& event) {
+ base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id) {
LayerAnimationElement::AnimatableProperty property =
- LayerAnimationElement::ToAnimatableProperty(event.target_property);
+ LayerAnimationElement::ToAnimatableProperty(target_property);
RunningAnimation* running = GetRunningAnimation(property);
if (!running)
return;
DCHECK(running->is_sequence_alive());
- if (running->sequence()->animation_group_id() != event.group_id)
+ if (running->sequence()->animation_group_id() != group_id)
return;
- running->sequence()->OnThreadedAnimationStarted(event);
+ running->sequence()->OnThreadedAnimationStarted(monotonic_time,
+ target_property, group_id);
if (!running->sequence()->waiting_for_group_start())
return;
- base::TimeTicks start_time = event.monotonic_time;
+ base::TimeTicks start_time = monotonic_time;
running->sequence()->set_waiting_for_group_start(false);
@@ -432,7 +432,7 @@
iter != running_animations_.end(); ++iter) {
// Ensure that each sequence is only Started once, regardless of the
// number of sequences in the group that have threaded first elements.
- if (((*iter).sequence()->animation_group_id() == event.group_id) &&
+ if (((*iter).sequence()->animation_group_id() == group_id) &&
!(*iter).sequence()->IsFirstElementThreaded() &&
(*iter).sequence()->waiting_for_group_start()) {
(*iter).sequence()->set_start_time(start_time);
@@ -952,8 +952,11 @@
return delegate_ ? delegate_->GetLayerAnimatorCollection() : NULL;
}
-void LayerAnimator::OnAnimationStarted(const cc::AnimationEvent& event) {
- OnThreadedAnimationStarted(event);
+void LayerAnimator::NotifyAnimationStarted(
+ base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group) {
+ OnThreadedAnimationStarted(monotonic_time, target_property, group);
}
LayerAnimator::RunningAnimation::RunningAnimation(
diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h
index c9dedd027..9bd9f05 100644
--- a/ui/compositor/layer_animator.h
+++ b/ui/compositor/layer_animator.h
@@ -15,7 +15,8 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/time/time.h"
-#include "cc/animation/layer_animation_event_observer.h"
+#include "cc/animation/animation_delegate.h"
+#include "cc/animation/target_property.h"
#include "ui/compositor/compositor_export.h"
#include "ui/compositor/layer_animation_element.h"
#include "ui/compositor/layer_threaded_animation_delegate.h"
@@ -56,7 +57,7 @@
class COMPOSITOR_EXPORT LayerAnimator
: public base::RefCounted<LayerAnimator>,
public LayerThreadedAnimationDelegate,
- NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) {
+ NON_EXPORTED_BASE(public cc::AnimationDelegate) {
public:
enum PreemptionStrategy {
IMMEDIATELY_SET_NEW_TARGET,
@@ -196,7 +197,9 @@
void RemoveObserver(LayerAnimationObserver* observer);
// Called when a threaded animation is actually started.
- void OnThreadedAnimationStarted(const cc::AnimationEvent& event);
+ void OnThreadedAnimationStarted(base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id);
// This determines how implicit animations will be tweened. This has no
// effect on animations that are explicitly started or scheduled. The default
@@ -339,8 +342,21 @@
LayerAnimatorCollection* GetLayerAnimatorCollection();
- // LayerAnimationEventObserver
- void OnAnimationStarted(const cc::AnimationEvent& event) override;
+ // cc::AnimationDelegate implementation.
+ void NotifyAnimationStarted(base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id) override;
+ void NotifyAnimationFinished(base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id) override {}
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ int group_id) override {}
+ void NotifyAnimationTakeover(
+ base::TimeTicks monotonic_time,
+ cc::TargetProperty::Type target_property,
+ double animation_start_time,
+ std::unique_ptr<cc::AnimationCurve> curve) override {}
// Implementation of LayerThreadedAnimationDelegate.
void AddThreadedAnimation(std::unique_ptr<cc::Animation> animation) override;
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index 89bb496..6367b58 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
-#include "cc/animation/animation_events.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_delegate.h"
@@ -372,11 +371,10 @@
base::TimeTicks start_time = test_controller.animator()->last_step_time();
base::TimeTicks effective_start = start_time + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ ->animation_group_id());
animator->Step(effective_start + delta / 2);
@@ -481,11 +479,10 @@
base::TimeTicks start_time = test_controller.animator()->last_step_time();
base::TimeTicks effective_start = start_time + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ ->animation_group_id());
animator->Step(effective_start + delta / 2);
@@ -742,11 +739,10 @@
base::TimeTicks start_time = test_controller.animator()->last_step_time();
base::TimeTicks effective_start = start_time + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ ->animation_group_id());
animator->Step(effective_start + delta / 2);
@@ -866,11 +862,10 @@
base::TimeTicks start_time = test_controller.animator()->last_step_time();
base::TimeTicks effective_start = start_time + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ ->animation_group_id());
animator->Step(effective_start + delta / 2);
@@ -889,11 +884,10 @@
base::TimeTicks second_effective_start = effective_start + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ second_effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, second_effective_start));
+ ->animation_group_id());
animator->Step(second_effective_start + delta / 2);
@@ -1189,11 +1183,10 @@
base::TimeTicks start_time = test_controller.animator()->last_step_time();
base::TimeTicks effective_start = start_time + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ ->animation_group_id());
animator->Step(effective_start + delta / 2);
@@ -1217,11 +1210,10 @@
base::TimeTicks second_effective_start = effective_start + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ second_effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, second_effective_start));
+ ->animation_group_id());
animator->Step(second_effective_start + delta / 2);
@@ -1459,22 +1451,20 @@
base::TimeTicks start_time = test_controller.animator()->last_step_time();
base::TimeTicks effective_start = start_time + delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, effective_start));
+ ->animation_group_id());
animator->Step(effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
base::TimeTicks second_effective_start = effective_start + 2 * delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ second_effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, second_effective_start));
+ ->animation_group_id());
animator->Step(second_effective_start + delta);
@@ -1482,22 +1472,20 @@
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity);
base::TimeTicks third_effective_start = second_effective_start + 2 * delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ third_effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, third_effective_start));
+ ->animation_group_id());
animator->Step(third_effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
base::TimeTicks fourth_effective_start = third_effective_start + 2 * delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ fourth_effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, fourth_effective_start));
+ ->animation_group_id());
// Skip ahead by a lot.
animator->Step(fourth_effective_start + 1000 * delta);
@@ -1506,11 +1494,10 @@
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity);
base::TimeTicks fifth_effective_start = fourth_effective_start + 1001 * delta;
- test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0,
+ test_controller.animator()->OnThreadedAnimationStarted(
+ fifth_effective_start, cc::TargetProperty::OPACITY,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
- ->animation_group_id(),
- cc::TargetProperty::OPACITY, fifth_effective_start));
+ ->animation_group_id());
// Skip ahead by a lot.
animator->Step(fifth_effective_start + 999 * delta);
diff --git a/ui/compositor/test/layer_animator_test_controller.cc b/ui/compositor/test/layer_animator_test_controller.cc
index 497cb92..611b2de 100644
--- a/ui/compositor/test/layer_animator_test_controller.cc
+++ b/ui/compositor/test/layer_animator_test_controller.cc
@@ -50,9 +50,9 @@
element->effective_start_time() != base::TimeTicks())
continue;
- animator_->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::STARTED, 0, element->animation_group_id(),
- threaded_properties[i], base::TimeTicks::Now()));
+ animator_->OnThreadedAnimationStarted(base::TimeTicks::Now(),
+ threaded_properties[i],
+ element->animation_group_id());
}
}