| OLD | NEW |
| 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/gpu/gpu_service_impl.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_mus.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 void EstablishGpuChannelDone( |
| 16 const mojom::GpuService::EstablishGpuChannelCallback& callback, | 16 const mojom::GpuService::EstablishGpuChannelCallback& callback, |
| 17 int32_t client_id, | 17 int32_t client_id, |
| 18 mojo::ScopedMessagePipeHandle handle) { | 18 mojo::ScopedMessagePipeHandle handle) { |
| 19 // TODO(penghuang): Send the real GPUInfo to the client. | 19 // TODO(penghuang): Send the real GPUInfo to the client. |
| 20 callback.Run(client_id, std::move(handle), gpu::GPUInfo()); | 20 callback.Run(client_id, std::move(handle), gpu::GPUInfo()); |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 GpuServiceImpl::GpuServiceImpl( | 24 GpuServiceProxy::GpuServiceProxy() |
| 25 mojo::InterfaceRequest<mojom::GpuService> request) | 25 : gpu_service_(GpuServiceInternal::GetInstance()) {} |
| 26 : binding_(this, std::move(request)) {} | |
| 27 | 26 |
| 28 GpuServiceImpl::~GpuServiceImpl() {} | 27 GpuServiceProxy::~GpuServiceProxy() {} |
| 29 | 28 |
| 30 void GpuServiceImpl::EstablishGpuChannel( | 29 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { |
| 30 bindings_.AddBinding(this, std::move(request)); |
| 31 } |
| 32 |
| 33 void GpuServiceProxy::EstablishGpuChannel( |
| 31 const mojom::GpuService::EstablishGpuChannelCallback& callback) { | 34 const mojom::GpuService::EstablishGpuChannelCallback& callback) { |
| 32 GpuServiceMus* service = GpuServiceMus::GetInstance(); | |
| 33 // TODO(penghuang): crbug.com/617415 figure out how to generate a meaningful | 35 // TODO(penghuang): crbug.com/617415 figure out how to generate a meaningful |
| 34 // tracing id. | 36 // tracing id. |
| 35 const uint64_t client_tracing_id = 0; | 37 const uint64_t client_tracing_id = 0; |
| 36 // TODO(penghuang): windows server may want to control those flags. | 38 // TODO(penghuang): windows server may want to control those flags. |
| 37 // Add a private interface for windows server. | 39 // Add a private interface for windows server. |
| 38 const bool preempts = false; | 40 const bool preempts = false; |
| 39 const bool allow_view_command_buffers = false; | 41 const bool allow_view_command_buffers = false; |
| 40 const bool allow_real_time_streams = false; | 42 const bool allow_real_time_streams = false; |
| 41 service->EstablishGpuChannel( | 43 gpu_service_->EstablishGpuChannel( |
| 42 client_tracing_id, preempts, allow_view_command_buffers, | 44 client_tracing_id, preempts, allow_view_command_buffers, |
| 43 allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback)); | 45 allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback)); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void GpuServiceImpl::CreateGpuMemoryBuffer( | 48 void GpuServiceProxy::CreateGpuMemoryBuffer( |
| 47 mojom::GpuMemoryBufferIdPtr id, | 49 mojom::GpuMemoryBufferIdPtr id, |
| 48 const gfx::Size& size, | 50 const gfx::Size& size, |
| 49 gfx::BufferFormat format, | 51 gfx::BufferFormat format, |
| 50 gfx::BufferUsage usage, | 52 gfx::BufferUsage usage, |
| 51 uint64_t surface_id, | 53 uint64_t surface_id, |
| 52 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) { | 54 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) { |
| 53 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id, | 58 void GpuServiceProxy::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id, |
| 57 const gpu::SyncToken& sync_token) { | 59 const gpu::SyncToken& sync_token) { |
| 58 NOTIMPLEMENTED(); | 60 NOTIMPLEMENTED(); |
| 59 } | 61 } |
| 60 | 62 |
| 61 } // namespace ui | 63 } // namespace ui |
| OLD | NEW |