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

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: Bring up oilpan support during compositor worker creation and oilpan the compositor mutator and pro… Created 4 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
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 9389cb2ee960d0cc95ef6bf6ccbfa40146865ad8..c825786c34ce0d856830c5af711c25ee72506bb0 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
@@ -24,8 +24,16 @@ 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, starterOriginPrivilegeData, workerClients)
+ , m_executingAnimationFrameCallbacks(false)
, m_callbackCollection(this)
{
+ CompositorProxyClient::from(clients())->setGlobalScope(this);
+ ThreadState::current()->registerPreFinalizer(this);
+}
+
+void CompositorWorkerGlobalScope::dispose()
+{
+ CompositorProxyClient::from(clients())->setGlobalScope(nullptr);
}
CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope()
@@ -54,6 +62,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 +73,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