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

Unified Diff: cc/animation/animation_player.cc

Issue 2756963002: Purge impl-only animations awaiting deletion in AnimationPlayer::UpdateState. (Closed)
Patch Set: Created 3 years, 9 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/animation_player.h ('k') | cc/animation/element_animations_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/animation_player.cc
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc
index af11dfc2c683ac09c409c7594327dd95757e4f55..d18f76884698caa7152a8d0ed9fd58237a570e2c 100644
--- a/cc/animation/animation_player.cc
+++ b/cc/animation/animation_player.cc
@@ -252,7 +252,7 @@ void AnimationPlayer::PushPropertiesTo(AnimationPlayer* player_impl) {
return;
MarkAbortedAnimationsForDeletion(player_impl);
- PurgeAnimationsMarkedForDeletion();
+ PurgeAnimationsMarkedForDeletion(/* impl_only */ false);
PushNewAnimationsToImplThread(player_impl);
// Remove finished impl side animations only after pushing,
@@ -297,6 +297,7 @@ void AnimationPlayer::UpdateState(bool start_ready_animations,
MarkFinishedAnimations(last_tick_time_);
MarkAnimationsForDeletion(last_tick_time_, events);
+ PurgeAnimationsMarkedForDeletion(/* impl_only */ true);
if (start_ready_animations) {
if (needs_to_start_animations()) {
@@ -1098,12 +1099,13 @@ void AnimationPlayer::MarkAbortedAnimationsForDeletion(
element_animations_->SetNeedsUpdateImplClientState();
}
-void AnimationPlayer::PurgeAnimationsMarkedForDeletion() {
+void AnimationPlayer::PurgeAnimationsMarkedForDeletion(bool impl_only) {
animations_.erase(
std::remove_if(animations_.begin(), animations_.end(),
- [](const std::unique_ptr<Animation>& animation) {
+ [impl_only](const std::unique_ptr<Animation>& animation) {
return animation->run_state() ==
- Animation::WAITING_FOR_DELETION;
+ Animation::WAITING_FOR_DELETION &&
+ (!impl_only || animation->is_impl_only());
}),
animations_.end());
}
« no previous file with comments | « cc/animation/animation_player.h ('k') | cc/animation/element_animations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698