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

Unified Diff: third_party/WebKit/Source/web/CompositorProxyClientImpl.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/web/CompositorProxyClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp b/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dd0424c2c911f0a4890149aaddccb3154f564943
--- /dev/null
+++ b/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "web/CompositorProxyClientImpl.h"
+
+#include "core/dom/CompositorProxy.h"
+#include "modules/compositorworker/CompositorWorkerGlobalScope.h"
+#include "platform/TraceEvent.h"
+#include "wtf/CurrentTime.h"
+
+namespace blink {
+
+CompositorProxyClientImpl::CompositorProxyClientImpl()
+ : m_globalScope(nullptr)
+{
+}
+
+DEFINE_TRACE(CompositorProxyClientImpl)
+{
+ CompositorProxyClient::trace(visitor);
+ visitor->trace(m_globalScope);
+}
+
+void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope");
+ DCHECK(!m_globalScope);
+ DCHECK(scope);
+ m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope);
+}
+
+void CompositorProxyClientImpl::runAnimationFrameCallbacks()
+{
+ m_requestedAnimationFrameCallbacks = true;
+ mutate(monotonicallyIncreasingTime());
+}
+
+bool CompositorProxyClientImpl::mutate(double monotonicTimeNow)
+{
+ if (!m_globalScope)
+ return false;
+
+ TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate");
+ if (!m_requestedAnimationFrameCallbacks)
+ return false;
+
+ m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(monotonicTimeNow);
+
+ return m_requestedAnimationFrameCallbacks;
+}
+
+bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicTimeNow)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimationFrameCallbacks");
+ // Convert to zero based document time in milliseconds consistent with requestAnimationFrame.
+ double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigin());
+ const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(highResTimeMs);
+ return shouldReinvoke;
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/CompositorProxyClientImpl.h ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698