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

Unified Diff: third_party/WebKit/Source/web/CompositorMutatorImpl.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/web/CompositorMutatorImpl.cpp
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2be6b7c3394931fddeb562a3ed6bf834c9c72b44
--- /dev/null
+++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
@@ -0,0 +1,67 @@
+// Copyright 2016 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/CompositorMutatorImpl.h"
+
+#include "core/animation/CustomCompositorAnimationManager.h"
+#include "core/dom/CompositorProxy.h"
+#include "platform/TraceEvent.h"
+#include "platform/graphics/CompositorMutationsTarget.h"
+#include "platform/graphics/CompositorMutatorClient.h"
+#include "platform/heap/Handle.h"
+#include "web/CompositorProxyClientImpl.h"
+
+namespace blink {
+
+CompositorMutatorImpl::CompositorMutatorImpl()
+ : m_animationManager(adoptPtr(new CustomCompositorAnimationManager))
+ , m_client(nullptr)
+{
+}
+
+CompositorMutatorImpl::~CompositorMutatorImpl()
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::~CompositorMutatorImpl");
+}
+
+CompositorMutatorImpl* CompositorMutatorImpl::create()
+{
+ return new CompositorMutatorImpl();
+}
+
+bool CompositorMutatorImpl::mutate(double monotonicTimeNow)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::mutate");
+ bool needToReinvoke = false;
+ // TODO(vollick): we should avoid executing the animation frame
+ // callbacks if none of the proxies in the global scope are affected by
+ // m_mutations.
+ for (CompositorProxyClientImpl* client : m_proxyClients) {
+ if (client->mutate(monotonicTimeNow))
+ needToReinvoke = true;
+ }
+
+ return needToReinvoke;
+}
+
+void CompositorMutatorImpl::registerProxyClient(CompositorProxyClientImpl* client)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::registerClient");
+ m_proxyClients.add(client);
+ setNeedsMutate();
+}
+
+void CompositorMutatorImpl::unregisterProxyClient(CompositorProxyClientImpl* client)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::unregisterClient");
+ m_proxyClients.remove(client);
+}
+
+void CompositorMutatorImpl::setNeedsMutate()
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate");
+ m_client->setNeedsMutate();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698