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

Unified Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp

Issue 1895873006: compositor-worker: Initialize CW machinery plumbing to compositor and fire CW rAF callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add big fat TODOs in scheduler code to implement proper idle task scheduling and ensure GC is runni… Created 4 years, 7 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
Index: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
index 38f958c7f366a1c3106d8af1cb3f3323c277d9be..d660f90cc768e4e0e1d986858c61e332b17bc914 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
@@ -24,8 +24,10 @@ CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorke
CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients)
: WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients)
+ , m_executingAnimationFrameCallbacks(false)
, m_callbackCollection(this)
{
+ CompositorProxyClient::from(clients())->setGlobalScope(this);
}
CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope()
@@ -54,6 +56,9 @@ void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext
int CompositorWorkerGlobalScope::requestAnimationFrame(FrameRequestCallback* callback)
{
+ const bool shouldSignal = !m_executingAnimationFrameCallbacks && m_callbackCollection.isEmpty();
+ if (shouldSignal)
+ CompositorProxyClient::from(clients())->requestAnimationFrame();
return m_callbackCollection.registerCallback(callback);
}
@@ -62,9 +67,11 @@ void CompositorWorkerGlobalScope::cancelAnimationFrame(int id)
m_callbackCollection.cancelCallback(id);
}
-void CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(double highResTimeNow)
+bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(double highResTimeMs)
{
- m_callbackCollection.executeCallbacks(highResTimeNow, highResTimeNow);
+ TemporaryChange<bool> temporaryChange(m_executingAnimationFrameCallbacks, true);
+ m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs);
+ return !m_callbackCollection.isEmpty();
}
CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const

Powered by Google App Engine
This is Rietveld 408576698