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

Unified Diff: components/mus/gpu/gpu_service_impl.cc

Issue 1976703003: Impl mus::mojom::GpuService to enable using Chrome IPC version gpu CmdBuf in mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « components/mus/gpu/gpu_service_impl.h ('k') | components/mus/gpu/gpu_service_mus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/gpu/gpu_service_impl.cc
diff --git a/components/mus/gpu/gpu_service_impl.cc b/components/mus/gpu/gpu_service_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..800611abd0950177f5b75ac51454a30c67c2e7b0
--- /dev/null
+++ b/components/mus/gpu/gpu_service_impl.cc
@@ -0,0 +1,78 @@
+// 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/gpu/gpu_service_impl.h"
+
+#include "components/mus/common/gpu_type_converters.h"
+#include "components/mus/gpu/gpu_service_mus.h"
+#include "services/shell/public/cpp/connection.h"
+
+namespace mus {
+
+namespace {
+
+void EstablishGpuChannelDone(
+ int32_t client_id,
+ const mojom::GpuService::EstablishGpuChannelCallback& callback,
+ const IPC::ChannelHandle& channel_handle) {
+ // TODO(penghuang): Send the real GPUInfo to the client.
+ callback.Run(client_id, mojom::ChannelHandle::From(channel_handle),
+ mojom::GpuInfo::From<gpu::GPUInfo>(gpu::GPUInfo()));
+}
+}
+
+GpuServiceImpl::GpuServiceImpl(
+ mojo::InterfaceRequest<mojom::GpuService> request,
+ shell::Connection* connection)
+ : binding_(this, std::move(request)),
+ client_id_(connection->GetRemoteInstanceID() + 1) {
+ // Use remote instead id + 1 as client id, so every GpuServiceImpl instances
+ // for a same client will have the same client id.
+ // Make sure client_id_ is greater than 1, because 1 is used for the local
+ // GpuChannel.
+ DCHECK_GT(client_id_, 1);
+}
+
+GpuServiceImpl::~GpuServiceImpl() {}
+
+void GpuServiceImpl::EstablishGpuChannel(
+ const mojom::GpuService::EstablishGpuChannelCallback& callback) {
+ GpuServiceMus* service = GpuServiceMus::GetInstance();
+ // TODO(penghuang): windows server may want to control those flags.
+ // Add a private interface for windows server.
+ const bool preempts = false;
+ const bool allow_view_command_buffers = false;
+ const bool allow_real_time_streams = false;
+ service->EstablishGpuChannel(
+ client_id_, client_id_, preempts, allow_view_command_buffers,
+ allow_real_time_streams,
+ base::Bind(&EstablishGpuChannelDone, client_id_, callback));
+}
+
+void GpuServiceImpl::CreateGpuMemoryBuffer(
+ mojom::GpuMemoryBufferIdPtr id,
+ const gfx::Size& size,
+ mojom::BufferFormat format,
+ mojom::BufferUsage usage,
+ uint64_t surface_id,
+ const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
+ NOTIMPLEMENTED();
+}
+
+void GpuServiceImpl::CreateGpuMemoryBufferFromHandle(
+ mojom::GpuMemoryBufferHandlePtr buffer_handle,
+ mojom::GpuMemoryBufferIdPtr id,
+ const gfx::Size& size,
+ mojom::BufferFormat format,
+ const mojom::GpuService::CreateGpuMemoryBufferFromHandleCallback&
+ callback) {
+ NOTIMPLEMENTED();
+}
+
+void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
+ const gpu::SyncToken& sync_token) {
+ NOTIMPLEMENTED();
+}
+
+} // namespace mus
« no previous file with comments | « components/mus/gpu/gpu_service_impl.h ('k') | components/mus/gpu/gpu_service_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698