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

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: Fix build error 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
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 GPUInfo to the client.
20 callback.Run(client_id, mojom::ChannelHandle::From(channel_handle), nullptr);
21 }
22 }
23
24 GpuServiceImpl::GpuServiceImpl(
25 mojo::InterfaceRequest<mojom::GpuService> request,
26 shell::Connection* connection)
27 : binding_(this, std::move(request)),
28 client_id_(connection->GetRemoteInstanceID() + 1) {
29 // Use remote instead id + 1 as client id, so every GpuServiceImpl instances
30 // for a same client will have the same client id.
31 // Make sure client_id_ is greater than 1, because 1 is used for the local
32 // GpuChannel.
33 DCHECK_GT(client_id_, 1);
34 }
35
36 GpuServiceImpl::~GpuServiceImpl() {}
37
38 void GpuServiceImpl::EstablishGpuChannel(
39 const mojom::GpuService::EstablishGpuChannelCallback& callback) {
40 GpuServiceMus* service = GpuServiceMus::GetInstance();
41 // TODO(penghuang): windows server may want to control those flags.
42 // Add a private interface for windows server.
43 const bool preempts = false;
44 const bool allow_view_command_buffers = false;
45 const bool allow_real_time_streams = false;
46 service->EstablishGpuChannel(
47 client_id_, client_id_, preempts, allow_view_command_buffers,
48 allow_real_time_streams,
49 base::Bind(&EstablishGpuChannelDone, client_id_, callback));
50 }
51
52 void GpuServiceImpl::CreateGpuMemoryBuffer(
53 mojom::GpuMemoryBufferIdPtr id,
54 const gfx::Size& size,
55 mojom::BufferFormat format,
56 mojom::BufferUsage usage,
57 uint64_t surface_id,
58 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
59 NOTIMPLEMENTED();
60 }
61
62 void GpuServiceImpl::CreateGpuMemoryBufferFromHandle(
63 mojom::GpuMemoryBufferHandlePtr buffer_handle,
64 mojom::GpuMemoryBufferIdPtr id,
65 const gfx::Size& size,
66 mojom::BufferFormat format,
67 const mojom::GpuService::CreateGpuMemoryBufferFromHandleCallback&
68 callback) {
69 NOTIMPLEMENTED();
70 }
71
72 void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
73 const gpu::SyncToken& sync_token) {
74 NOTIMPLEMENTED();
75 }
76
77 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698