Index: cc/animation/animation_player.cc |
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc |
index 4cbd2a027aa23f0c8d1af605ef48d56d72a963d7..ef0c40038d36b9c0477216226c379d75fdd8d9cf 100644 |
--- a/cc/animation/animation_player.cc |
+++ b/cc/animation/animation_player.cc |
@@ -104,15 +104,16 @@ void AnimationPlayer::BindElementAnimations() { |
DCHECK(element_animations_); |
// Pass all accumulated animations to ElementAnimations. |
- for (auto& animation : animations_) { |
+ for (auto& animation : animations_) |
element_animations_->AddAnimation(std::move(animation)); |
- } |
- if (!animations_.empty()) |
- SetNeedsCommit(); |
animations_.clear(); |
+ |
+ SetNeedsPushProperties(); |
} |
void AnimationPlayer::UnbindElementAnimations() { |
+ SetNeedsPushProperties(); |
+ |
element_animations_ = nullptr; |
DCHECK(animations_.empty()); |
} |
@@ -123,7 +124,7 @@ void AnimationPlayer::AddAnimation(std::unique_ptr<Animation> animation) { |
if (element_animations_) { |
element_animations_->AddAnimation(std::move(animation)); |
- SetNeedsCommit(); |
+ SetNeedsPushProperties(); |
} else { |
animations_.push_back(std::move(animation)); |
} |
@@ -133,13 +134,13 @@ void AnimationPlayer::PauseAnimation(int animation_id, double time_offset) { |
DCHECK(element_animations_); |
element_animations_->PauseAnimation( |
animation_id, base::TimeDelta::FromSecondsD(time_offset)); |
- SetNeedsCommit(); |
+ SetNeedsPushProperties(); |
} |
void AnimationPlayer::RemoveAnimation(int animation_id) { |
if (element_animations_) { |
element_animations_->RemoveAnimation(animation_id); |
- SetNeedsCommit(); |
+ SetNeedsPushProperties(); |
} else { |
auto animations_to_remove = std::remove_if( |
animations_.begin(), animations_.end(), |
@@ -153,14 +154,14 @@ void AnimationPlayer::RemoveAnimation(int animation_id) { |
void AnimationPlayer::AbortAnimation(int animation_id) { |
DCHECK(element_animations_); |
element_animations_->AbortAnimation(animation_id); |
- SetNeedsCommit(); |
+ SetNeedsPushProperties(); |
} |
void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property, |
bool needs_completion) { |
if (element_animations_) { |
element_animations_->AbortAnimations(target_property, needs_completion); |
- SetNeedsCommit(); |
+ SetNeedsPushProperties(); |
} else { |
auto animations_to_remove = std::remove_if( |
animations_.begin(), animations_.end(), |
@@ -172,6 +173,10 @@ void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property, |
} |
void AnimationPlayer::PushPropertiesTo(AnimationPlayer* player_impl) { |
+ if (!needs_push_properties_) |
+ return; |
+ needs_push_properties_ = false; |
+ |
if (element_id_ != player_impl->element_id()) { |
if (player_impl->element_id()) |
player_impl->DetachElement(); |
@@ -207,6 +212,10 @@ void AnimationPlayer::NotifyAnimationAborted( |
group); |
} |
+void AnimationPlayer::NotifyAnimationWaitingForDeletion() { |
+ SetNeedsPushProperties(); |
+} |
+ |
void AnimationPlayer::NotifyAnimationTakeover( |
base::TimeTicks monotonic_time, |
TargetProperty::Type target_property, |
@@ -220,10 +229,14 @@ void AnimationPlayer::NotifyAnimationTakeover( |
} |
} |
-void AnimationPlayer::SetNeedsCommit() { |
- DCHECK(animation_host_); |
- animation_host_->SetNeedsCommit(); |
- animation_host_->SetNeedsRebuildPropertyTrees(); |
+void AnimationPlayer::SetNeedsPushProperties() { |
+ needs_push_properties_ = true; |
+ |
+ DCHECK(animation_timeline_); |
+ animation_timeline_->SetNeedsPushProperties(); |
+ |
+ DCHECK(element_animations_); |
+ element_animations_->SetNeedsPushProperties(); |
} |
} // namespace cc |