| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // The client Id 1 is reserved for the display compositor. | 25 // The client Id 1 is reserved for the display compositor. |
| 26 const int32_t kInternalGpuChannelClientId = 2; | 26 const int32_t kInternalGpuChannelClientId = 2; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate) | 30 GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate) |
| 31 : delegate_(delegate), | 31 : delegate_(delegate), |
| 32 next_client_id_(kInternalGpuChannelClientId + 1), | 32 next_client_id_(kInternalGpuChannelClientId + 1), |
| 33 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) { | 33 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) { |
| 34 gpu_main_.OnStart(); | 34 gpu_main_impl_ = base::MakeUnique<GpuMain>(GetProxy(&gpu_main_)); |
| 35 gpu_main_impl_->OnStart(); |
| 35 // TODO(sad): Once GPU process is split, this would look like: | 36 // TODO(sad): Once GPU process is split, this would look like: |
| 36 // connector->ConnectToInterface("gpu", &gpu_service_); | 37 // connector->ConnectToInterface("gpu", &gpu_main_); |
| 37 gpu_main_.Create(GetProxy(&gpu_service_)); | 38 gpu_main_->CreateGpuService( |
| 38 gpu_service_->Initialize( | 39 GetProxy(&gpu_service_), |
| 39 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); | 40 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); |
| 40 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( | 41 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( |
| 41 gpu_service_.get(), next_client_id_++); | 42 gpu_service_.get(), next_client_id_++); |
| 42 } | 43 } |
| 43 | 44 |
| 44 GpuServiceProxy::~GpuServiceProxy() { | 45 GpuServiceProxy::~GpuServiceProxy() { |
| 45 } | 46 } |
| 46 | 47 |
| 47 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { | 48 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { |
| 48 bindings_.AddBinding(this, std::move(request)); | 49 bindings_.AddBinding(this, std::move(request)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void GpuServiceProxy::CreateDisplayCompositor( | 52 void GpuServiceProxy::CreateDisplayCompositor( |
| 52 cc::mojom::DisplayCompositorRequest request, | 53 cc::mojom::DisplayCompositorRequest request, |
| 53 cc::mojom::DisplayCompositorClientPtr client) { | 54 cc::mojom::DisplayCompositorClientPtr client) { |
| 54 gpu_service_->CreateDisplayCompositor(std::move(request), std::move(client)); | 55 gpu_main_->CreateDisplayCompositor(std::move(request), std::move(client)); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) { | 58 void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) { |
| 58 gpu_info_ = gpu_info; | 59 gpu_info_ = gpu_info; |
| 59 | 60 |
| 60 delegate_->OnGpuServiceInitialized(); | 61 delegate_->OnGpuServiceInitialized(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void GpuServiceProxy::OnGpuChannelEstablished( | 64 void GpuServiceProxy::OnGpuChannelEstablished( |
| 64 const EstablishGpuChannelCallback& callback, | 65 const EstablishGpuChannelCallback& callback, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 id, size, format)); | 98 id, size, format)); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 101 void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 101 const gpu::SyncToken& sync_token) { | 102 const gpu::SyncToken& sync_token) { |
| 102 // NOTIMPLEMENTED(); | 103 // NOTIMPLEMENTED(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace ws | 106 } // namespace ws |
| 106 } // namespace ui | 107 } // namespace ui |
| OLD | NEW |