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

Unified Diff: components/mus/surfaces/compositor_frame_sink_factory_impl.cc

Issue 1989693002: Introduce DisplayCompositor Mojo API for Mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix client_id 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: components/mus/surfaces/compositor_frame_sink_factory_impl.cc
diff --git a/components/mus/surfaces/compositor_frame_sink_factory_impl.cc b/components/mus/surfaces/compositor_frame_sink_factory_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..40d48d6b1c067ac8612e68497236a934a25aa3b3
--- /dev/null
+++ b/components/mus/surfaces/compositor_frame_sink_factory_impl.cc
@@ -0,0 +1,46 @@
+// 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 "components/mus/surfaces/compositor_frame_sink_factory_impl.h"
+
+#include "base/memory/ptr_util.h"
+#include "cc/surfaces/surface_id.h"
+#include "components/mus/surfaces/compositor_frame_sink_impl.h"
+
+namespace mus {
+namespace gpu {
+
+CompositorFrameSinkFactoryImpl::CompositorFrameSinkFactoryImpl(
+ uint32_t client_id,
+ mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request,
+ const scoped_refptr<SurfacesState>& surfaces_state)
+ : client_id_(client_id),
+ surfaces_state_(surfaces_state),
+ allocator_(client_id),
+ binding_(this, std::move(request)) {}
+
+CompositorFrameSinkFactoryImpl::~CompositorFrameSinkFactoryImpl() {}
+
+void CompositorFrameSinkFactoryImpl::CompositorFrameSinkConnectionLost(
+ int local_id) {
+ sinks_.erase(local_id);
+}
+
+cc::SurfaceId CompositorFrameSinkFactoryImpl::GenerateSurfaceId() {
+ return allocator_.GenerateId();
+}
+
+void CompositorFrameSinkFactoryImpl::CreateCompositorFrameSink(
+ uint32_t local_id,
+ uint64_t nonce,
+ mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
+ mojom::CompositorFrameSinkClientPtr client) {
+ // TODO(fsamuel): Use nonce once patch lands:
+ // https://codereview.chromium.org/1996783002/
+ sinks_[local_id] = base::WrapUnique(new CompositorFrameSinkImpl(
+ this, local_id, surfaces_state_, std::move(sink), std::move(client)));
+}
+
+} // namespace gpu
+} // namespace mus
« no previous file with comments | « components/mus/surfaces/compositor_frame_sink_factory_impl.h ('k') | components/mus/surfaces/compositor_frame_sink_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698