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

Unified Diff: third_party/WebKit/Source/core/animation/AnimationStack.cpp

Issue 1698093005: Discard SampledEffects on elements if they are redundant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_renameToSampledEffect
Patch Set: Rebased Created 4 years, 10 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
Index: third_party/WebKit/Source/core/animation/AnimationStack.cpp
diff --git a/third_party/WebKit/Source/core/animation/AnimationStack.cpp b/third_party/WebKit/Source/core/animation/AnimationStack.cpp
index e4f0061d1c7863cfad387b5c2b18d7a740451ce3..6c4de42f269ef6a79af74e187085fbefb83ef3a6 100644
--- a/third_party/WebKit/Source/core/animation/AnimationStack.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationStack.cpp
@@ -101,7 +101,7 @@ ActiveInterpolationsMap AnimationStack::activeInterpolations(AnimationStack* ani
HeapVector<Member<SampledEffect>>& sampledEffects = animationStack->m_sampledEffects;
// std::sort doesn't work with OwnPtrs
nonCopyingSort(sampledEffects.begin(), sampledEffects.end(), compareSampledEffects);
- animationStack->removeClearedSampledEffects();
+ animationStack->removeRedundantSampledEffects();
for (const auto& sampledEffect : sampledEffects) {
if (sampledEffect->priority() != priority || (suppressedAnimations && sampledEffect->effect() && suppressedAnimations->contains(sampledEffect->effect()->animation())))
continue;
@@ -115,14 +115,25 @@ ActiveInterpolationsMap AnimationStack::activeInterpolations(AnimationStack* ani
return result;
}
-void AnimationStack::removeClearedSampledEffects()
+void AnimationStack::removeRedundantSampledEffects()
{
- size_t dest = 0;
+ HashSet<PropertyHandle> replacedProperties;
+ for (size_t i = m_sampledEffects.size(); i--;) {
+ SampledEffect& sampledEffect = *m_sampledEffects[i];
+ if (sampledEffect.willNeverChange()) {
+ sampledEffect.removeReplacedInterpolations(replacedProperties);
+ sampledEffect.updateReplacedProperties(replacedProperties);
+ }
+ }
+
+ size_t newSize = 0;
for (auto& sampledEffect : m_sampledEffects) {
- if (sampledEffect->effect())
- m_sampledEffects[dest++].swap(sampledEffect);
+ if (!sampledEffect->interpolations().isEmpty())
+ m_sampledEffects[newSize++].swap(sampledEffect);
+ else if (sampledEffect->effect())
+ sampledEffect->effect()->notifySampledEffectRemovedFromAnimationStack();
}
- m_sampledEffects.shrink(dest);
+ m_sampledEffects.shrink(newSize);
}
DEFINE_TRACE(AnimationStack)

Powered by Google App Engine
This is Rietveld 408576698