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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/mus/gpu/gpu_service_impl.h"
6
7 #include "components/mus/common/gpu_type_converters.h"
8 #include "components/mus/gpu/gpu_service_mus.h"
9 #include "services/shell/public/cpp/connection.h"
10
11 namespace mus {
12
13 namespace {
14
15 void EstablishGpuChannelDone(
16 int32_t client_id,
17 const mojom::GpuService::EstablishGpuChannelCallback& callback,
18 const IPC::ChannelHandle& channel_handle) {
19 // TODO(penghuang): Send the real GPUInfo to the client.
20 callback.Run(client_id, mojom::ChannelHandle::From(channel_handle),
21 mojom::GpuInfo::From<gpu::GPUInfo>(gpu::GPUInfo()));
22 }
23 }
24
25 GpuServiceImpl::GpuServiceImpl(
26 mojo::InterfaceRequest<mojom::GpuService> request,
27 shell::Connection* connection)
28 : binding_(this, std::move(request)),
29 client_id_(connection->GetRemoteInstanceID() + 1) {
30 // Use remote instead id + 1 as client id, so every GpuServiceImpl instances
31 // for a same client will have the same client id.
32 // Make sure client_id_ is greater than 1, because 1 is used for the local
33 // GpuChannel.
34 DCHECK_GT(client_id_, 1);
35 }
36
37 GpuServiceImpl::~GpuServiceImpl() {}
38
39 void GpuServiceImpl::EstablishGpuChannel(
40 const mojom::GpuService::EstablishGpuChannelCallback& callback) {
41 GpuServiceMus* service = GpuServiceMus::GetInstance();
42 // TODO(penghuang): windows server may want to control those flags.
43 // Add a private interface for windows server.
44 const bool preempts = false;
45 const bool allow_view_command_buffers = false;
46 const bool allow_real_time_streams = false;
47 service->EstablishGpuChannel(
48 client_id_, client_id_, preempts, allow_view_command_buffers,
49 allow_real_time_streams,
50 base::Bind(&EstablishGpuChannelDone, client_id_, callback));
51 }
52
53 void GpuServiceImpl::CreateGpuMemoryBuffer(
54 mojom::GpuMemoryBufferIdPtr id,
55 const gfx::Size& size,
56 mojom::BufferFormat format,
57 mojom::BufferUsage usage,
58 uint64_t surface_id,
59 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
60 NOTIMPLEMENTED();
61 }
62
63 void GpuServiceImpl::CreateGpuMemoryBufferFromHandle(
64 mojom::GpuMemoryBufferHandlePtr buffer_handle,
65 mojom::GpuMemoryBufferIdPtr id,
66 const gfx::Size& size,
67 mojom::BufferFormat format,
68 const mojom::GpuService::CreateGpuMemoryBufferFromHandleCallback&
69 callback) {
70 NOTIMPLEMENTED();
71 }
72
73 void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
74 const gpu::SyncToken& sync_token) {
75 NOTIMPLEMENTED();
76 }
77
78 } // namespace mus
OLDNEW
« 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