| Index: Source/core/animation/AnimationTimeline.cpp
|
| diff --git a/Source/core/animation/AnimationTimeline.cpp b/Source/core/animation/AnimationTimeline.cpp
|
| index 82af9a72ebc204cedf0ef3100ce996c89446b864..7827a075bfe9dffa5435b517aa07110ae10f5cc1 100644
|
| --- a/Source/core/animation/AnimationTimeline.cpp
|
| +++ b/Source/core/animation/AnimationTimeline.cpp
|
| @@ -68,6 +68,7 @@ AnimationTimeline::AnimationTimeline(Document* document, PassOwnPtrWillBeRawPtr<
|
| : m_document(document)
|
| , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader
|
| , m_zeroTimeInitialized(false)
|
| + , m_outdatedAnimationCount(0)
|
| , m_playbackRate(1)
|
| , m_lastCurrentTimeInternal(0)
|
| {
|
| @@ -147,12 +148,17 @@ void AnimationTimeline::serviceAnimations(TimingUpdateReason reason)
|
| m_animationsNeedingUpdate.remove(animation);
|
| }
|
|
|
| - ASSERT(!hasOutdatedAnimation());
|
| + ASSERT(m_outdatedAnimationCount == 0);
|
| +
|
| +#if ENABLE(ASSERT)
|
| + for (const auto& animation : m_animationsNeedingUpdate)
|
| + ASSERT(!animation->outdated());
|
| +#endif
|
| }
|
|
|
| void AnimationTimeline::scheduleNextService()
|
| {
|
| - ASSERT(!hasOutdatedAnimation());
|
| + ASSERT(m_outdatedAnimationCount == 0);
|
|
|
| double timeToNextEffect = std::numeric_limits<double>::infinity();
|
| for (const auto& animation : m_animationsNeedingUpdate) {
|
| @@ -262,23 +268,21 @@ void AnimationTimeline::pauseAnimationsForTesting(double pauseTime)
|
| serviceAnimations(TimingUpdateOnDemand);
|
| }
|
|
|
| -bool AnimationTimeline::hasOutdatedAnimation() const
|
| +bool AnimationTimeline::needsAnimationTimingUpdate()
|
| {
|
| - for (const auto& animation : m_animationsNeedingUpdate) {
|
| - if (animation->outdated())
|
| - return true;
|
| - }
|
| - return false;
|
| + return m_animationsNeedingUpdate.size() && currentTimeInternal() != m_lastCurrentTimeInternal;
|
| }
|
|
|
| -bool AnimationTimeline::needsAnimationTimingUpdate()
|
| +void AnimationTimeline::clearOutdatedAnimation(Animation* animation)
|
| {
|
| - return m_animationsNeedingUpdate.size() && currentTimeInternal() != m_lastCurrentTimeInternal;
|
| + ASSERT(!animation->outdated());
|
| + m_outdatedAnimationCount--;
|
| }
|
|
|
| void AnimationTimeline::setOutdatedAnimation(Animation* animation)
|
| {
|
| ASSERT(animation->outdated());
|
| + m_outdatedAnimationCount++;
|
| m_animationsNeedingUpdate.add(animation);
|
| if (m_document && m_document->page() && !m_document->page()->animator().isServicingAnimations())
|
| m_timing->serviceOnNextFrame();
|
|
|