| 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/ws/gpu_service_proxy.h" | 5 #include "services/ui/ws/gpu_service_proxy.h" |
| 6 | 6 |
| 7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "gpu/ipc/client/gpu_channel_host.h" | 11 #include "gpu/ipc/client/gpu_channel_host.h" |
| 12 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 12 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
| 13 #include "mojo/public/cpp/system/buffer.h" | 13 #include "mojo/public/cpp/system/buffer.h" |
| 14 #include "mojo/public/cpp/system/platform_handle.h" | 14 #include "mojo/public/cpp/system/platform_handle.h" |
| 15 #include "services/service_manager/public/cpp/connection.h" | 15 #include "services/service_manager/public/cpp/connection.h" |
| 16 #include "services/ui/common/mus_gpu_memory_buffer_manager.h" |
| 16 #include "services/ui/ws/gpu_service_proxy_delegate.h" | 17 #include "services/ui/ws/gpu_service_proxy_delegate.h" |
| 17 #include "ui/gfx/buffer_format_util.h" | 18 #include "ui/gfx/buffer_format_util.h" |
| 18 | 19 |
| 19 namespace ui { | 20 namespace ui { |
| 20 namespace ws { | 21 namespace ws { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // The client Id 1 is reserved for the display compositor. | 25 // The client Id 1 is reserved for the display compositor. |
| 25 const int32_t kInternalGpuChannelClientId = 2; | 26 const int32_t kInternalGpuChannelClientId = 2; |
| 26 | 27 |
| 27 } // namespace | 28 } // namespace |
| 28 | 29 |
| 29 GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate) | 30 GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate) |
| 30 : delegate_(delegate), | 31 : delegate_(delegate), |
| 31 next_client_id_(kInternalGpuChannelClientId + 1), | 32 next_client_id_(kInternalGpuChannelClientId + 1), |
| 32 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) { | 33 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) { |
| 33 gpu_main_.OnStart(); | 34 gpu_main_.OnStart(); |
| 34 // TODO(sad): Once GPU process is split, this would look like: | 35 // TODO(sad): Once GPU process is split, this would look like: |
| 35 // connector->ConnectToInterface("gpu", &gpu_service_); | 36 // connector->ConnectToInterface("gpu", &gpu_service_); |
| 36 gpu_main_.Create(GetProxy(&gpu_service_)); | 37 gpu_main_.Create(GetProxy(&gpu_service_)); |
| 37 gpu_service_->Initialize( | 38 gpu_service_->Initialize( |
| 38 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); | 39 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); |
| 40 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( |
| 41 gpu_service_.get(), next_client_id_++); |
| 39 } | 42 } |
| 40 | 43 |
| 41 GpuServiceProxy::~GpuServiceProxy() { | 44 GpuServiceProxy::~GpuServiceProxy() { |
| 42 } | 45 } |
| 43 | 46 |
| 44 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { | 47 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { |
| 45 bindings_.AddBinding(this, std::move(request)); | 48 bindings_.AddBinding(this, std::move(request)); |
| 46 } | 49 } |
| 47 | 50 |
| 48 void GpuServiceProxy::CreateDisplayCompositor( | 51 void GpuServiceProxy::CreateDisplayCompositor( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 id, size, format)); | 97 id, size, format)); |
| 95 } | 98 } |
| 96 | 99 |
| 97 void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 100 void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 98 const gpu::SyncToken& sync_token) { | 101 const gpu::SyncToken& sync_token) { |
| 99 // NOTIMPLEMENTED(); | 102 // NOTIMPLEMENTED(); |
| 100 } | 103 } |
| 101 | 104 |
| 102 } // namespace ws | 105 } // namespace ws |
| 103 } // namespace ui | 106 } // namespace ui |
| OLD | NEW |