Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4134)

Unified Diff: cc/animation/layer_animation_controller.cc

Issue 1893253002: CC Animation: Make LayerAnimationController to have just one event observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rc
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/layer_animation_controller.cc
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index b2130b8a6ab1f2e65e3adb6f85e53585fa1c3753..c722dc59af2bb56d92c640f4e6ed505b0efb9457 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -28,6 +28,7 @@ LayerAnimationController::LayerAnimationController(int id)
: host_(0),
id_(id),
is_active_(false),
+ event_observer_(nullptr),
value_observer_(nullptr),
value_provider_(nullptr),
layer_animation_delegate_(nullptr),
@@ -390,8 +391,8 @@ void LayerAnimationController::SetAnimationHost(AnimationHost* host) {
void LayerAnimationController::NotifyAnimationStarted(
const AnimationEvent& event) {
if (event.is_impl_only) {
- FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
- OnAnimationStarted(event));
+ if (event_observer_)
+ event_observer_->OnAnimationStarted(event);
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationStarted(
event.monotonic_time, event.target_property, event.group_id);
@@ -406,8 +407,8 @@ void LayerAnimationController::NotifyAnimationStarted(
if (!animations_[i]->has_set_start_time())
animations_[i]->set_start_time(event.monotonic_time);
- FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
- OnAnimationStarted(event));
+ if (event_observer_)
+ event_observer_->OnAnimationStarted(event);
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationStarted(
event.monotonic_time, event.target_property, event.group_id);
@@ -488,15 +489,9 @@ void LayerAnimationController::NotifyAnimationPropertyUpdate(
}
}
-void LayerAnimationController::AddEventObserver(
+void LayerAnimationController::SetEventObserver(
LayerAnimationEventObserver* observer) {
- if (!event_observers_.HasObserver(observer))
- event_observers_.AddObserver(observer);
-}
-
-void LayerAnimationController::RemoveEventObserver(
- LayerAnimationEventObserver* observer) {
- event_observers_.RemoveObserver(observer);
+ event_observer_ = observer;
}
bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const {
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698