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 17 matching lines...) Expand all Loading... | |
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_.OnStart(); |
35 // TODO(sad): Once GPU process is split, this would look like: | 35 // TODO(sad): Once GPU process is split, this would look like: |
36 // connector->ConnectToInterface("gpu", &gpu_service_); | 36 // connector->ConnectToInterface("gpu", &gpu_service_); |
37 gpu_main_.Create(GetProxy(&gpu_service_)); | 37 gpu_main_.Create(GetProxy(&gpu_service_)); |
38 pending_display_compositor_factory_request_ = | |
39 GetProxy(&display_compositor_factory_); | |
38 gpu_service_->Initialize( | 40 gpu_service_->Initialize( |
39 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); | 41 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); |
40 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( | 42 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( |
41 gpu_service_.get(), next_client_id_++); | 43 gpu_service_.get(), next_client_id_++); |
42 } | 44 } |
43 | 45 |
44 GpuServiceProxy::~GpuServiceProxy() { | 46 GpuServiceProxy::~GpuServiceProxy() { |
45 } | 47 } |
46 | 48 |
47 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { | 49 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { |
48 bindings_.AddBinding(this, std::move(request)); | 50 bindings_.AddBinding(this, std::move(request)); |
49 } | 51 } |
50 | 52 |
51 void GpuServiceProxy::CreateDisplayCompositor( | 53 void GpuServiceProxy::CreateDisplayCompositor( |
52 cc::mojom::DisplayCompositorRequest request, | 54 cc::mojom::DisplayCompositorRequest request, |
53 cc::mojom::DisplayCompositorClientPtr client) { | 55 cc::mojom::DisplayCompositorClientPtr client) { |
54 gpu_service_->CreateDisplayCompositor(std::move(request), std::move(client)); | 56 display_compositor_factory_->CreateDisplayCompositor(std::move(request), |
57 std::move(client)); | |
sadrul
2016/11/29 19:46:41
Dumb question: why can't WindowServer do this:
c
Fady Samuel
2016/11/29 20:08:58
It can. It's a matter of style I guess. I see no c
| |
55 } | 58 } |
56 | 59 |
57 void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) { | 60 void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) { |
58 gpu_info_ = gpu_info; | 61 gpu_info_ = gpu_info; |
62 // TODO(fsamuel): Once GPU process is split, this would look like: | |
63 // connector->ConnectToInterface("gpu", &display_compositor_factory_); | |
64 gpu_main_.Create(std::move(pending_display_compositor_factory_request_)); | |
59 | 65 |
60 delegate_->OnGpuServiceInitialized(); | 66 delegate_->OnGpuServiceInitialized(); |
61 } | 67 } |
62 | 68 |
63 void GpuServiceProxy::OnGpuChannelEstablished( | 69 void GpuServiceProxy::OnGpuChannelEstablished( |
64 const EstablishGpuChannelCallback& callback, | 70 const EstablishGpuChannelCallback& callback, |
65 int32_t client_id, | 71 int32_t client_id, |
66 mojo::ScopedMessagePipeHandle channel_handle) { | 72 mojo::ScopedMessagePipeHandle channel_handle) { |
67 callback.Run(client_id, std::move(channel_handle), gpu_info_); | 73 callback.Run(client_id, std::move(channel_handle), gpu_info_); |
68 } | 74 } |
(...skipping 28 matching lines...) Expand all Loading... | |
97 id, size, format)); | 103 id, size, format)); |
98 } | 104 } |
99 | 105 |
100 void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 106 void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
101 const gpu::SyncToken& sync_token) { | 107 const gpu::SyncToken& sync_token) { |
102 // NOTIMPLEMENTED(); | 108 // NOTIMPLEMENTED(); |
103 } | 109 } |
104 | 110 |
105 } // namespace ws | 111 } // namespace ws |
106 } // namespace ui | 112 } // namespace ui |
OLD | NEW |