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

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

Issue 1625473002: compositor-worker: blink->cc plumbing Base URL: https://chromium.googlesource.com/chromium/src.git@upstream-compositor-worker
Patch Set: Merge with landing of https://codereview.chromium.org/1599673002/ on master Created 4 years, 11 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 aa495efd7e60256c7eac965fc58fd83a8012af16..543984210fa4c993e24c93f8d84a5e4a6627a913 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
@@ -23,8 +23,11 @@ PassRefPtrWillBeRawPtr<CompositorWorkerGlobalScope> CompositorWorkerGlobalScope:
CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients)
: WorkerGlobalScope(url, userAgent, thread, timeOrigin, starterOriginPrivilegeData, workerClients)
+ , m_executingAnimationFrameCallbacks(false)
, m_callbackCollection(this)
+ , m_client(CompositorProxyClient::from(clients()))
{
+ m_client->setGlobalScope(this);
}
CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope()
@@ -53,6 +56,9 @@ void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext
int CompositorWorkerGlobalScope::requestAnimationFrame(FrameRequestCallback* callback)
{
+ const bool shouldSignal = !m_executingAnimationFrameCallbacks && m_callbackCollection.isEmpty();
+ if (shouldSignal)
+ m_client->requestMutation();
return m_callbackCollection.registerCallback(callback);
}
@@ -61,9 +67,11 @@ void CompositorWorkerGlobalScope::cancelAnimationFrame(int id)
m_callbackCollection.cancelCallback(id);
}
-void CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(double highResTimeNow)
+bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(double highResTimeNow)
{
+ TemporaryChange<bool> temporaryChange(m_executingAnimationFrameCallbacks, true);
m_callbackCollection.executeCallbacks(highResTimeNow, highResTimeNow);
+ return !m_callbackCollection.isEmpty();
}
CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const

Powered by Google App Engine
This is Rietveld 408576698