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

Unified Diff: Source/core/animation/SampledEffect.cpp

Issue 967523002: Revert of Web Animations: Remove AnimationPlayer discarding logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/SampledEffect.cpp
diff --git a/Source/core/animation/SampledEffect.cpp b/Source/core/animation/SampledEffect.cpp
index e950fb59ffe9bca232d62e68229a701991d6a3d5..b57235af5d6c3d6795c4cabca19d8aa92b6eb3f4 100644
--- a/Source/core/animation/SampledEffect.cpp
+++ b/Source/core/animation/SampledEffect.cpp
@@ -11,7 +11,9 @@
SampledEffect::SampledEffect(Animation* animation, PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > interpolations)
: m_animation(animation)
+#if !ENABLE(OILPAN)
, m_player(animation->player())
+#endif
, m_interpolations(interpolations)
, m_sequenceNumber(animation->player()->sequenceNumber())
, m_priority(animation->priority())
@@ -19,11 +21,38 @@
ASSERT(m_interpolations && !m_interpolations->isEmpty());
}
+bool SampledEffect::canChange() const
+{
+#if ENABLE(OILPAN)
+ return m_animation;
+#else
+ if (!m_animation)
+ return false;
+ // FIXME: This check won't be needed when Animation and AnimationPlayer are moved to Oilpan.
+ return !m_player->canFree();
+#endif
+}
+
void SampledEffect::clear()
{
+#if !ENABLE(OILPAN)
m_player = nullptr;
+#endif
m_animation = nullptr;
m_interpolations->clear();
+}
+
+void SampledEffect::removeReplacedInterpolationsIfNeeded(const BitArray<numCSSProperties>& replacedProperties)
+{
+ if (canChange() && m_animation->isCurrent())
+ return;
+
+ size_t dest = 0;
+ for (auto& interpolation : *m_interpolations) {
+ if (!replacedProperties.get(toStyleInterpolation(interpolation.get())->id()))
+ m_interpolations->at(dest++) = interpolation;
+ }
+ m_interpolations->shrink(dest);
}
DEFINE_TRACE(SampledEffect)
« no previous file with comments | « Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698