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

Unified Diff: third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp

Issue 2257803002: Refactor SMILTimeContainer can-schedule-frame predicate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@smilcontainer-timeline-cleanup
Patch Set: Rebase Created 4 years, 4 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 | « third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
diff --git a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
index 0dc66056d202a6a8b6756f53575fcbb2e643a80d..09b1c7efcc9319f4fd52b778410bad27bffea3a5 100644
--- a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
+++ b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
@@ -183,20 +183,7 @@ void SMILTimeContainer::start()
// setElapsed() before the document began.
// In this case pass on 'seekToTime=true' to updateAnimations() to issue a seek.
SMILTime earliestFireTime = updateAnimations(SMILTime(m_presentationTime), m_presentationTime ? true : false);
-
- if (isPaused()) {
- // If updateAnimations() caused new syncbase instances to be generated,
- // we don't want to cancel those. Excepting that, no frame should've
- // been scheduled at this point.
- DCHECK(m_frameSchedulingState == Idle || m_frameSchedulingState == SynchronizeAnimations);
- return;
- }
- // If synchronizations are pending, those will in turn schedule additional
- // frames.
- if (hasPendingSynchronization())
- return;
- DCHECK(isTimelineRunning());
- if (!earliestFireTime.isFinite())
+ if (!canScheduleFrame(earliestFireTime))
return;
// If the timeline is running, and there are pending animation updates,
// always perform the first update after the timeline was started using
@@ -417,23 +404,25 @@ void SMILTimeContainer::serviceAnimations()
updateAnimationsAndScheduleFrameIfNeeded(elapsed());
}
+bool SMILTimeContainer::canScheduleFrame(SMILTime earliestFireTime) const
+{
+ // If there's synchronization pending (most likely due to syncbases), then
+ // let that complete first before attempting to schedule a frame.
+ if (hasPendingSynchronization())
+ return false;
+ if (!isTimelineRunning())
+ return false;
+ return earliestFireTime.isFinite();
+}
+
void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToTime)
{
if (!document().isActive())
return;
SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime);
- // If updateAnimations() ended up triggering a synchronization (most likely
- // via syncbases), then give that priority.
- if (hasPendingSynchronization())
- return;
-
- if (!isTimelineRunning())
+ if (!canScheduleFrame(earliestFireTime))
return;
-
- if (!earliestFireTime.isFinite())
- return;
-
SMILTime delay = earliestFireTime - elapsed;
scheduleAnimationFrame(delay.value());
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698