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

Unified Diff: Source/core/dom/ScriptedAnimationController.cpp

Issue 1093803002: ScriptedAnimationController: factor out has-schedulable items predicate. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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/dom/ScriptedAnimationController.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ScriptedAnimationController.cpp
diff --git a/Source/core/dom/ScriptedAnimationController.cpp b/Source/core/dom/ScriptedAnimationController.cpp
index e7aaba9a76410dfb1ac7934f848e91b823fa7e40..ea8ee6a11472249a99a477abbca1dc39c63afbf7 100644
--- a/Source/core/dom/ScriptedAnimationController.cpp
+++ b/Source/core/dom/ScriptedAnimationController.cpp
@@ -151,12 +151,17 @@ void ScriptedAnimationController::callMediaQueryListListeners()
}
}
-void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTimeNow)
+bool ScriptedAnimationController::hasScheduledItems() const
{
- if (m_callbackCollection.isEmpty() && !m_eventQueue.size() && !m_mediaQueryListListeners.size())
- return;
-
if (m_suspendCount)
+ return false;
+
+ return !m_callbackCollection.isEmpty() || !m_eventQueue.isEmpty() || !m_mediaQueryListListeners.isEmpty();
+}
+
+void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTimeNow)
+{
+ if (!hasScheduledItems())
return;
RefPtrWillBeRawPtr<ScriptedAnimationController> protect(this);
@@ -192,13 +197,10 @@ void ScriptedAnimationController::enqueueMediaQueryChangeListeners(WillBeHeapVec
void ScriptedAnimationController::scheduleAnimationIfNeeded()
{
- if (!m_document)
- return;
-
- if (m_suspendCount)
+ if (!hasScheduledItems())
return;
- if (m_callbackCollection.isEmpty() && !m_eventQueue.size() && !m_mediaQueryListListeners.size())
+ if (!m_document)
return;
if (FrameView* frameView = m_document->view())
« no previous file with comments | « Source/core/dom/ScriptedAnimationController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698