summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/animation/animation_delegate.h4
-rw-r--r--cc/animation/animation_host.cc3
-rw-r--r--cc/animation/animation_player.cc9
-rw-r--r--cc/animation/animation_player.h3
-rw-r--r--cc/animation/element_animations.cc11
-rw-r--r--cc/animation/element_animations.h3
-rw-r--r--cc/animation/layer_animation_controller.cc3
-rw-r--r--cc/animation/layer_animation_controller_unittest.cc17
-rw-r--r--cc/blink/web_compositor_animation_player_unittest.cc1
-rw-r--r--cc/blink/web_to_cc_animation_delegate_adapter.cc8
-rw-r--r--cc/blink/web_to_cc_animation_delegate_adapter.h3
-rw-r--r--cc/layers/layer_impl.h3
-rw-r--r--cc/test/animation_timelines_test_common.h3
-rw-r--r--cc/test/test_hooks.h3
14 files changed, 73 insertions, 1 deletions
diff --git a/cc/animation/animation_delegate.h b/cc/animation/animation_delegate.h
index 8c736b5..6064c7e 100644
--- a/cc/animation/animation_delegate.h
+++ b/cc/animation/animation_delegate.h
@@ -20,6 +20,10 @@ class CC_EXPORT AnimationDelegate {
Animation::TargetProperty target_property,
int group) = 0;
+ virtual void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) = 0;
+
protected:
virtual ~AnimationDelegate() {}
};
diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc
index 59ce274..1df11d0 100644
--- a/cc/animation/animation_host.cc
+++ b/cc/animation/animation_host.cc
@@ -114,6 +114,9 @@ class AnimationHost::ScrollOffsetAnimations : public AnimationDelegate {
DCHECK(animation_host_->mutator_host_client());
animation_host_->mutator_host_client()->ScrollOffsetAnimationFinished();
}
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) override {}
private:
void ReattachScrollOffsetPlayerIfNeeded(int layer_id) {
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc
index dd7cb1f..52fa9a8 100644
--- a/cc/animation/animation_player.cc
+++ b/cc/animation/animation_player.cc
@@ -203,6 +203,15 @@ void AnimationPlayer::NotifyAnimationFinished(
target_property, group);
}
+void AnimationPlayer::NotifyAnimationAborted(
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) {
+ if (layer_animation_delegate_)
+ layer_animation_delegate_->NotifyAnimationAborted(monotonic_time,
+ target_property, group);
+}
+
void AnimationPlayer::SetNeedsCommit() {
DCHECK(animation_host_);
animation_host_->SetNeedsCommit();
diff --git a/cc/animation/animation_player.h b/cc/animation/animation_player.h
index 396d977..4902ec4 100644
--- a/cc/animation/animation_player.h
+++ b/cc/animation/animation_player.h
@@ -80,6 +80,9 @@ class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>,
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group);
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group);
private:
friend class base::RefCounted<AnimationPlayer>;
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc
index 1264718..cd3a736 100644
--- a/cc/animation/element_animations.cc
+++ b/cc/animation/element_animations.cc
@@ -259,6 +259,17 @@ void ElementAnimations::NotifyAnimationFinished(
}
}
+void ElementAnimations::NotifyAnimationAborted(
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) {
+ for (PlayersListNode* node = players_list_->head();
+ node != players_list_->end(); node = node->next()) {
+ AnimationPlayer* player = node->value();
+ player->NotifyAnimationAborted(monotonic_time, target_property, group);
+ }
+}
+
gfx::ScrollOffset ElementAnimations::ScrollOffsetForAnimation() const {
DCHECK(layer_animation_controller_);
if (animation_host()) {
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h
index de76291..7a9cd93 100644
--- a/cc/animation/element_animations.h
+++ b/cc/animation/element_animations.h
@@ -100,6 +100,9 @@ class CC_EXPORT ElementAnimations : public AnimationDelegate,
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group) override;
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) override;
// LayerAnimationValueProvider implementation.
gfx::ScrollOffset ScrollOffsetForAnimation() const override;
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index e4e4513..8d77951 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -461,6 +461,9 @@ void LayerAnimationController::NotifyAnimationAborted(
animations_[i]->target_property() == event.target_property) {
animations_[i]->SetRunState(Animation::ABORTED, event.monotonic_time);
animations_[i]->set_received_finished_event(true);
+ if (layer_animation_delegate_)
+ layer_animation_delegate_->NotifyAnimationAborted(
+ event.monotonic_time, event.target_property, event.group_id);
if (event.target_property == Animation::TRANSFORM)
aborted_transform_animation = true;
}
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index 850123c..2f5f37e 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -1018,7 +1018,10 @@ TEST(LayerAnimationControllerTest, ScrollOffsetRemovalClearsScrollDelta) {
class FakeAnimationDelegate : public AnimationDelegate {
public:
FakeAnimationDelegate()
- : started_(false), finished_(false), start_time_(base::TimeTicks()) {}
+ : started_(false),
+ finished_(false),
+ aborted_(false),
+ start_time_(base::TimeTicks()) {}
void NotifyAnimationStarted(TimeTicks monotonic_time,
Animation::TargetProperty target_property,
@@ -1033,15 +1036,24 @@ class FakeAnimationDelegate : public AnimationDelegate {
finished_ = true;
}
+ void NotifyAnimationAborted(TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) override {
+ aborted_ = true;
+ }
+
bool started() { return started_; }
bool finished() { return finished_; }
+ bool aborted() { return aborted_; }
+
TimeTicks start_time() { return start_time_; }
private:
bool started_;
bool finished_;
+ bool aborted_;
TimeTicks start_time_;
};
@@ -1843,6 +1855,8 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) {
scoped_refptr<LayerAnimationController> controller(
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
+ FakeAnimationDelegate delegate;
+ controller->set_layer_animation_delegate(&delegate);
int animation_id =
AddOpacityTransitionToController(controller.get(), 1.0, 0.f, 1.f, false);
@@ -1869,6 +1883,7 @@ TEST(LayerAnimationControllerTest, ImplThreadAbortedAnimationGetsDeleted) {
controller->NotifyAnimationAborted(events.events_[0]);
EXPECT_EQ(Animation::ABORTED,
controller->GetAnimation(Animation::OPACITY)->run_state());
+ EXPECT_TRUE(delegate.aborted());
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
controller->UpdateState(true, nullptr);
diff --git a/cc/blink/web_compositor_animation_player_unittest.cc b/cc/blink/web_compositor_animation_player_unittest.cc
index 8a3b154..ec355b1 100644
--- a/cc/blink/web_compositor_animation_player_unittest.cc
+++ b/cc/blink/web_compositor_animation_player_unittest.cc
@@ -25,6 +25,7 @@ class MockWebCompositorAnimationDelegate
MOCK_METHOD2(notifyAnimationStarted, void(double, int));
MOCK_METHOD2(notifyAnimationFinished, void(double, int));
+ MOCK_METHOD2(notifyAnimationAborted, void(double, int));
};
// Test that when the animation delegate is null, the animation player
diff --git a/cc/blink/web_to_cc_animation_delegate_adapter.cc b/cc/blink/web_to_cc_animation_delegate_adapter.cc
index fcec11f..3bdf0d4 100644
--- a/cc/blink/web_to_cc_animation_delegate_adapter.cc
+++ b/cc/blink/web_to_cc_animation_delegate_adapter.cc
@@ -40,4 +40,12 @@ void WebToCCAnimationDelegateAdapter::NotifyAnimationFinished(
#endif
}
+void WebToCCAnimationDelegateAdapter::NotifyAnimationAborted(
+ base::TimeTicks monotonic_time,
+ cc::Animation::TargetProperty target_property,
+ int group) {
+ delegate_->notifyAnimationAborted(
+ (monotonic_time - base::TimeTicks()).InSecondsF(), group);
+}
+
} // namespace cc_blink
diff --git a/cc/blink/web_to_cc_animation_delegate_adapter.h b/cc/blink/web_to_cc_animation_delegate_adapter.h
index 72e79e6..343afa5 100644
--- a/cc/blink/web_to_cc_animation_delegate_adapter.h
+++ b/cc/blink/web_to_cc_animation_delegate_adapter.h
@@ -27,6 +27,9 @@ class WebToCCAnimationDelegateAdapter : public cc::AnimationDelegate {
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
cc::Animation::TargetProperty target_property,
int group) override;
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ cc::Animation::TargetProperty target_property,
+ int group) override;
blink::WebCompositorAnimationDelegate* delegate_;
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 990a384..4dca350 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -125,6 +125,9 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group) override;
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) override{};
// Tree structure.
LayerImpl* parent() { return parent_; }
diff --git a/cc/test/animation_timelines_test_common.h b/cc/test/animation_timelines_test_common.h
index 518929d6..1733ca8 100644
--- a/cc/test/animation_timelines_test_common.h
+++ b/cc/test/animation_timelines_test_common.h
@@ -151,6 +151,9 @@ class TestAnimationDelegate : public AnimationDelegate {
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group) override;
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) override {}
bool started_;
bool finished_;
};
diff --git a/cc/test/test_hooks.h b/cc/test/test_hooks.h
index fd45cbc..8caec7f 100644
--- a/cc/test/test_hooks.h
+++ b/cc/test/test_hooks.h
@@ -130,6 +130,9 @@ class TestHooks : public AnimationDelegate {
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group) override {}
+ void NotifyAnimationAborted(base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property,
+ int group) override {}
virtual void RequestNewOutputSurface() = 0;
};