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

Side by Side Diff: services/ui/ws/gpu_service_proxy.cc

Issue 2276963002: services/ui: Introduce mojom.GpuServiceInternal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus-gpu-renames
Patch Set: . Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/gpu_service_proxy.h" 5 #include "services/ui/ws/gpu_service_proxy.h"
6 6
7 #include "services/shell/public/cpp/connection.h" 7 #include "services/shell/public/cpp/connection.h"
8 #include "services/ui/common/gpu_type_converters.h" 8 #include "services/ui/common/gpu_type_converters.h"
9 #include "services/ui/gpu/gpu_service_internal.h" 9 #include "services/ui/gpu/gpu_service_internal.h"
10 10
11 namespace ui { 11 namespace ui {
12 12
13 namespace { 13 GpuServiceProxy::GpuServiceProxy() {
14 14 // TODO(sad): Once GPU process is split, this would look like:
15 void EstablishGpuChannelDone( 15 // connector->ConnectToInterface("mojo:gpu", &gpu_service_);
16 const mojom::GpuService::EstablishGpuChannelCallback& callback, 16 GpuServiceInternal::GetInstance()->Add(GetProxy(&gpu_service_));
17 int32_t client_id, 17 gpu_service_->Initialize(
18 mojo::ScopedMessagePipeHandle handle) { 18 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this)));
19 // TODO(penghuang): Send the real GPUInfo to the client.
20 callback.Run(client_id, std::move(handle), gpu::GPUInfo());
21 } 19 }
22 }
23
24 GpuServiceProxy::GpuServiceProxy()
25 : gpu_service_(GpuServiceInternal::GetInstance()) {}
26 20
27 GpuServiceProxy::~GpuServiceProxy() {} 21 GpuServiceProxy::~GpuServiceProxy() {}
28 22
29 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { 23 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) {
30 bindings_.AddBinding(this, std::move(request)); 24 bindings_.AddBinding(this, std::move(request));
31 } 25 }
32 26
27 void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) {
28 gpu_info_ = gpu_info;
29 }
30
31 void GpuServiceProxy::OnGpuChannelEstablished(
32 const EstablishGpuChannelCallback& callback,
33 int32_t client_id,
34 mojo::ScopedMessagePipeHandle channel_handle) {
35 callback.Run(client_id, std::move(channel_handle), gpu_info_);
36 }
37
33 void GpuServiceProxy::EstablishGpuChannel( 38 void GpuServiceProxy::EstablishGpuChannel(
34 const mojom::GpuService::EstablishGpuChannelCallback& callback) { 39 const EstablishGpuChannelCallback& callback) {
35 // TODO(penghuang): crbug.com/617415 figure out how to generate a meaningful
36 // tracing id.
37 const uint64_t client_tracing_id = 0;
38 // TODO(penghuang): windows server may want to control those flags.
39 // Add a private interface for windows server.
40 const bool preempts = false;
41 const bool allow_view_command_buffers = false;
42 const bool allow_real_time_streams = false;
43 gpu_service_->EstablishGpuChannel( 40 gpu_service_->EstablishGpuChannel(
44 client_tracing_id, preempts, allow_view_command_buffers, 41 base::Bind(&GpuServiceProxy::OnGpuChannelEstablished,
45 allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback)); 42 base::Unretained(this), callback));
46 } 43 }
47 44
48 void GpuServiceProxy::CreateGpuMemoryBuffer( 45 void GpuServiceProxy::CreateGpuMemoryBuffer(
49 mojom::GpuMemoryBufferIdPtr id, 46 mojom::GpuMemoryBufferIdPtr id,
50 const gfx::Size& size, 47 const gfx::Size& size,
51 gfx::BufferFormat format, 48 gfx::BufferFormat format,
52 gfx::BufferUsage usage, 49 gfx::BufferUsage usage,
53 uint64_t surface_id, 50 uint64_t surface_id,
54 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) { 51 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
55 NOTIMPLEMENTED(); 52 NOTIMPLEMENTED();
56 } 53 }
57 54
58 void GpuServiceProxy::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id, 55 void GpuServiceProxy::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
59 const gpu::SyncToken& sync_token) { 56 const gpu::SyncToken& sync_token) {
60 NOTIMPLEMENTED(); 57 NOTIMPLEMENTED();
61 } 58 }
62 59
63 } // namespace ui 60 } // namespace ui
OLDNEW
« services/ui/gpu/interfaces/gpu_service_internal.mojom ('K') | « services/ui/ws/gpu_service_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698