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

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

Issue 1956893003: compositor-worker: Add CompositorProxyClient worker client of CompositorWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use local root frame and remove unneeded includes. 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 d096af9c9e7ef851d323b2a0e2ef4e75d162c99d..ea923d77bb426586ba6f66796cb53c03810fd1c0 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,12 @@ void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext
int CompositorWorkerGlobalScope::requestAnimationFrame(FrameRequestCallback* callback)
{
+ // For now, just post a task to call mutate on the compositor proxy client.
+ // TODO(flackr): Remove this as soon as CompositorProxyClient can request a
+ // compositor frame from the CompositorMutatorImpl.
+ thread()->postTask(BLINK_FROM_HERE, createSameThreadTask(&CompositorProxyClient::runAnimationFrameCallbacks,
+ CompositorProxyClient::from(clients())));
+ // TODO(flackr): Signal the compositor to call mutate on the next compositor frame.
return m_callbackCollection.registerCallback(callback);
}
@@ -62,9 +70,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