diff options
author | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 18:59:17 +0000 |
---|---|---|
committer | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 18:59:17 +0000 |
commit | 79eb14f69953b8a9a021c87ee3788c4904caf6d4 (patch) | |
tree | 37814e07db721c39dd80a365a852d40bb7b67b5f /cc/animation/layer_animation_controller.cc | |
parent | 1d93c487c97f5ca53b8004dd7842f1ee39ba8783 (diff) | |
download | chromium_src-79eb14f69953b8a9a021c87ee3788c4904caf6d4.zip chromium_src-79eb14f69953b8a9a021c87ee3788c4904caf6d4.tar.gz chromium_src-79eb14f69953b8a9a021c87ee3788c4904caf6d4.tar.bz2 |
Fix main-thread event handling for impl-only animations
Since impl-only animations have no main-thread counterpart, the
main thread (more specifically, LayerTreeHost::SetAnimationEvents,
LayerAnimationController::NotifyAnimationStarted, and
LayerAnimationController::NotifyAnimationFinished) should not
assume that incoming events will be for animations that are
running on the main thread.
BUG=196284
Review URL: https://chromiumcodereview.appspot.com/14137009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/animation/layer_animation_controller.cc')
-rw-r--r-- | cc/animation/layer_animation_controller.cc | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc index a026cce..5e20dd5 100644 --- a/cc/animation/layer_animation_controller.cc +++ b/cc/animation/layer_animation_controller.cc @@ -172,7 +172,7 @@ void LayerAnimationController::AccumulatePropertyUpdates( monotonic_time); event.opacity = animation->curve()->ToFloatAnimationCurve()->GetValue( monotonic_time); - + event.is_impl_only = true; events->push_back(event); } else if (animation->target_property() == Animation::Transform) { AnimationEvent event(AnimationEvent::PropertyUpdate, @@ -183,6 +183,7 @@ void LayerAnimationController::AccumulatePropertyUpdates( event.transform = animation->curve()->ToTransformAnimationCurve()->GetValue( monotonic_time); + event.is_impl_only = true; events->push_back(event); } } @@ -270,6 +271,15 @@ void LayerAnimationController::SetAnimationRegistrar( void LayerAnimationController::NotifyAnimationStarted( const AnimationEvent& event, double wall_clock_time) { + if (event.is_impl_only) { + FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, + OnAnimationStarted(event)); + if (layer_animation_delegate_) + layer_animation_delegate_->notifyAnimationStarted(wall_clock_time); + + return; + } + for (size_t i = 0; i < active_animations_.size(); ++i) { if (active_animations_[i]->group() == event.group_id && active_animations_[i]->target_property() == event.target_property && @@ -290,6 +300,12 @@ void LayerAnimationController::NotifyAnimationStarted( void LayerAnimationController::NotifyAnimationFinished( const AnimationEvent& event, double wall_clock_time) { + if (event.is_impl_only) { + if (layer_animation_delegate_) + layer_animation_delegate_->notifyAnimationFinished(wall_clock_time); + return; + } + for (size_t i = 0; i < active_animations_.size(); ++i) { if (active_animations_[i]->group() == event.group_id && active_animations_[i]->target_property() == event.target_property) { @@ -490,12 +506,14 @@ void LayerAnimationController::PromoteStartedAnimations( if (!active_animations_[i]->has_set_start_time()) active_animations_[i]->set_start_time(monotonic_time); if (events) { - events->push_back(AnimationEvent( + AnimationEvent started_event( AnimationEvent::Started, id_, active_animations_[i]->group(), active_animations_[i]->target_property(), - monotonic_time)); + monotonic_time); + started_event.is_impl_only = active_animations_[i]->is_impl_only(); + events->push_back(started_event); } } } @@ -577,12 +595,14 @@ void LayerAnimationController::MarkAnimationsForDeletion( for (size_t j = i; j < active_animations_.size(); j++) { if (group_id == active_animations_[j]->group()) { if (events) { - events->push_back(AnimationEvent( + AnimationEvent finished_event( AnimationEvent::Finished, id_, active_animations_[j]->group(), active_animations_[j]->target_property(), - monotonic_time)); + monotonic_time); + finished_event.is_impl_only = active_animations_[j]->is_impl_only(); + events->push_back(finished_event); } active_animations_[j]->SetRunState(Animation::WaitingForDeletion, monotonic_time); |