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

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
« no previous file with comments | « services/ui/ws/gpu_service_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 namespace {
14 14
15 void EstablishGpuChannelDone( 15 const int32_t kLocalGpuChannelClientId = 1;
16 const mojom::GpuService::EstablishGpuChannelCallback& callback, 16
17 int32_t client_id, 17 } // namespace
18 mojo::ScopedMessagePipeHandle handle) { 18
19 // TODO(penghuang): Send the real GPUInfo to the client. 19 GpuServiceProxy::GpuServiceProxy() : next_client_id_(kLocalGpuChannelClientId) {
20 callback.Run(client_id, std::move(handle), gpu::GPUInfo()); 20 // TODO(sad): Once GPU process is split, this would look like:
21 // connector->ConnectToInterface("mojo:gpu", &gpu_service_);
22 GpuServiceInternal::GetInstance()->Add(GetProxy(&gpu_service_));
23 gpu_service_->Initialize(
24 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this)));
21 } 25 }
22 }
23
24 GpuServiceProxy::GpuServiceProxy()
25 : gpu_service_(GpuServiceInternal::GetInstance()) {}
26 26
27 GpuServiceProxy::~GpuServiceProxy() {} 27 GpuServiceProxy::~GpuServiceProxy() {}
28 28
29 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { 29 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) {
30 bindings_.AddBinding(this, std::move(request)); 30 bindings_.AddBinding(this, std::move(request));
31 } 31 }
32 32
33 void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) {
34 gpu_info_ = gpu_info;
35 }
36
37 void GpuServiceProxy::OnGpuChannelEstablished(
38 const EstablishGpuChannelCallback& callback,
39 int32_t client_id,
40 mojo::ScopedMessagePipeHandle channel_handle) {
41 callback.Run(client_id, std::move(channel_handle), gpu_info_);
42 }
43
33 void GpuServiceProxy::EstablishGpuChannel( 44 void GpuServiceProxy::EstablishGpuChannel(
34 const mojom::GpuService::EstablishGpuChannelCallback& callback) { 45 const EstablishGpuChannelCallback& callback) {
35 // TODO(penghuang): crbug.com/617415 figure out how to generate a meaningful 46 const int client_id = ++next_client_id_;
36 // tracing id. 47 // TODO(sad): crbug.com/617415 figure out how to generate a meaningful tracing
48 // id.
37 const uint64_t client_tracing_id = 0; 49 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( 50 gpu_service_->EstablishGpuChannel(
44 client_tracing_id, preempts, allow_view_command_buffers, 51 client_id, client_tracing_id,
45 allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback)); 52 base::Bind(&GpuServiceProxy::OnGpuChannelEstablished,
53 base::Unretained(this), callback, client_id));
46 } 54 }
47 55
48 void GpuServiceProxy::CreateGpuMemoryBuffer( 56 void GpuServiceProxy::CreateGpuMemoryBuffer(
49 mojom::GpuMemoryBufferIdPtr id, 57 mojom::GpuMemoryBufferIdPtr id,
50 const gfx::Size& size, 58 const gfx::Size& size,
51 gfx::BufferFormat format, 59 gfx::BufferFormat format,
52 gfx::BufferUsage usage, 60 gfx::BufferUsage usage,
53 uint64_t surface_id, 61 uint64_t surface_id,
54 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) { 62 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
55 NOTIMPLEMENTED(); 63 NOTIMPLEMENTED();
56 } 64 }
57 65
58 void GpuServiceProxy::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id, 66 void GpuServiceProxy::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
59 const gpu::SyncToken& sync_token) { 67 const gpu::SyncToken& sync_token) {
60 NOTIMPLEMENTED(); 68 NOTIMPLEMENTED();
61 } 69 }
62 70
63 } // namespace ui 71 } // namespace ui
OLDNEW
« no previous file with comments | « 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