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

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

Issue 2536643002: Introduce animation frame tasks (Closed)
Patch Set: Created 4 years, 1 month 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/dom/ScriptedAnimationController.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/dom/ScriptedAnimationController.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp b/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
index 05e09a4ca48b9b9877118a3151132cf402a5f9fd..1fdfc54efb8cee105ecde2fe2434c650d7a155ed 100644
--- a/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
@@ -81,6 +81,13 @@ void ScriptedAnimationController::cancelCallback(CallbackId id) {
m_callbackCollection.cancelCallback(id);
}
+void ScriptedAnimationController::runTasks() {
+ // TODO(foolip): can running a task append to the task queue?
Sami 2016/11/28 15:50:27 FWIW I'd suggest they get added to the queue for t
foolip 2016/12/06 14:01:22 I have made it so and written tests, can you PTAL?
+ for (std::unique_ptr<WTF::Closure>& task : m_taskQueue)
+ (*task)();
+ m_taskQueue.clear();
+}
+
void ScriptedAnimationController::dispatchEvents(
const AtomicString& eventInterfaceFilter) {
HeapVector<Member<Event>> events;
@@ -144,8 +151,8 @@ bool ScriptedAnimationController::hasScheduledItems() const {
if (m_suspendCount)
return false;
- return !m_callbackCollection.isEmpty() || !m_eventQueue.isEmpty() ||
- !m_mediaQueryListListeners.isEmpty();
+ return !m_callbackCollection.isEmpty() || !m_taskQueue.isEmpty() ||
+ !m_eventQueue.isEmpty() || !m_mediaQueryListListeners.isEmpty();
}
void ScriptedAnimationController::serviceScriptedAnimations(
@@ -155,11 +162,18 @@ void ScriptedAnimationController::serviceScriptedAnimations(
callMediaQueryListListeners();
dispatchEvents();
+ runTasks(); // must be after resize event per spec
executeCallbacks(monotonicTimeNow);
scheduleAnimationIfNeeded();
}
+void ScriptedAnimationController::enqueueTask(
+ std::unique_ptr<WTF::Closure> task) {
+ m_taskQueue.append(std::move(task));
+ scheduleAnimationIfNeeded();
+}
+
void ScriptedAnimationController::enqueueEvent(Event* event) {
InspectorInstrumentation::asyncTaskScheduled(
event->target()->getExecutionContext(), event->type(), event);
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptedAnimationController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698