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

Unified Diff: third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.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/platform/graphics/CompositorMutatorClient.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9e79fa5c583f276a893c3beb9ce541abe921b41f
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp
@@ -0,0 +1,60 @@
+// 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 "platform/graphics/CompositorMutatorClient.h"
+
+#include "cc/animation/mutable_properties.h"
+#include "platform/TraceEvent.h"
+#include "platform/graphics/CompositorMutableProperties.h"
+#include "platform/graphics/CompositorMutableStateProvider.h"
+#include "platform/graphics/CompositorMutation.h"
+#include "platform/graphics/CompositorMutator.h"
+#include "public/platform/WebCompositorMutations.h"
+
+namespace blink {
+
+CompositorMutatorClient::CompositorMutatorClient(CompositorMutator* mutator)
+ : m_client(nullptr)
+ , m_mutator(mutator)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::CompositorMutatorClient");
+}
+
+CompositorMutatorClient::~CompositorMutatorClient()
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::~CompositorMutatorClient");
+}
+
+bool CompositorMutatorClient::Mutate(
+ base::TimeTicks now,
+ cc::LayerTreeImpl* state)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::GetMutations");
+ double time = (now - base::TimeTicks()).InSecondsF();
+ if (!m_mutations)
+ m_mutations = adoptPtr(new CompositorMutations);
+ CompositorMutableStateProvider compositorState(state, m_mutations.get());
+ bool shouldReinvoke = m_mutator->mutate(time, &compositorState);
+ return shouldReinvoke;
+}
+
+void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client)
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient");
+ m_client = client;
+ setNeedsMutate();
+}
+
+scoped_ptr<cc::LayerTreeMutations> CompositorMutatorClient::TakeMutations()
+{
+ return make_scoped_ptr<cc::LayerTreeMutations>(m_mutations.leakPtr());
+}
+
+void CompositorMutatorClient::setNeedsMutate()
+{
+ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::requestMutation");
+ m_client->SetNeedsMutate();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698