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

Side by Side Diff: services/ui/ws/gpu_service_proxy.h

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Speculative fix for android build issue Created 4 years, 1 month 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
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 #ifndef SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ 5 #ifndef SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
6 #define SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ 6 #define SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
7 7
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "gpu/config/gpu_info.h" 11 #include "gpu/config/gpu_info.h"
12 #include "gpu/ipc/client/gpu_channel_host.h" 12 #include "gpu/ipc/client/gpu_channel_host.h"
13 #include "mojo/public/cpp/bindings/binding_set.h" 13 #include "mojo/public/cpp/bindings/binding_set.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 14 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "services/ui/gpu/gpu_main.h" 15 #include "services/ui/gpu/gpu_main.h"
16 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" 16 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
17 #include "services/ui/public/interfaces/gpu_memory_buffer.mojom.h" 17 #include "services/ui/public/interfaces/gpu_memory_buffer.mojom.h"
18 #include "services/ui/public/interfaces/gpu_service.mojom.h" 18 #include "services/ui/public/interfaces/gpu_service.mojom.h"
19 19
20 namespace gpu {
21 class GpuChannelHost;
22 }
23
24 namespace ui { 20 namespace ui {
25 21
26 class GpuServiceInternal; 22 class GpuServiceInternal;
23 class MusGpuMemoryBufferManager;
27 24
28 namespace ws { 25 namespace ws {
29 26
30 class GpuServiceProxyDelegate; 27 class GpuServiceProxyDelegate;
31 class MusGpuMemoryBufferManager;
32 28
33 // The proxy implementation that relays requests from clients to the real 29 // The proxy implementation that relays requests from clients to the real
34 // service implementation in the GPU process over mojom.GpuServiceInternal. 30 // service implementation in the GPU process over mojom.GpuServiceInternal.
35 class GpuServiceProxy : public mojom::GpuService, 31 class GpuServiceProxy : public mojom::GpuService {
36 public gpu::GpuChannelHostFactory {
37 public: 32 public:
38 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); 33 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate);
39 ~GpuServiceProxy() override; 34 ~GpuServiceProxy() override;
40 35
41 void Add(mojom::GpuServiceRequest request); 36 void Add(mojom::GpuServiceRequest request);
42 37
38 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu.
39 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request,
40 cc::mojom::DisplayCompositorClientPtr client);
41
43 private: 42 private:
44 void OnInitialized(const gpu::GPUInfo& gpu_info); 43 void OnInitialized(const gpu::GPUInfo& gpu_info);
45 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback, 44 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback,
46 int32_t client_id, 45 int32_t client_id,
47 mojo::ScopedMessagePipeHandle channel_handle); 46 mojo::ScopedMessagePipeHandle channel_handle);
48 void OnInternalGpuChannelEstablished(
49 mojo::ScopedMessagePipeHandle channel_handle);
50 47
51 // mojom::GpuService overrides: 48 // mojom::GpuService overrides:
52 void EstablishGpuChannel( 49 void EstablishGpuChannel(
53 const EstablishGpuChannelCallback& callback) override; 50 const EstablishGpuChannelCallback& callback) override;
54 void CreateGpuMemoryBuffer( 51 void CreateGpuMemoryBuffer(
55 gfx::GpuMemoryBufferId id, 52 gfx::GpuMemoryBufferId id,
56 const gfx::Size& size, 53 const gfx::Size& size,
57 gfx::BufferFormat format, 54 gfx::BufferFormat format,
58 gfx::BufferUsage usage, 55 gfx::BufferUsage usage,
59 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) 56 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback)
60 override; 57 override;
61 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 58 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
62 const gpu::SyncToken& sync_token) override; 59 const gpu::SyncToken& sync_token) override;
63 60
64 // gpu::GpuChannelHostFactory overrides: 61 GpuServiceProxyDelegate* const delegate_;
65 bool IsMainThread() override;
66 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
67 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
68 size_t size) override;
69
70 GpuServiceProxyDelegate* delegate_;
71 int32_t next_client_id_; 62 int32_t next_client_id_;
72 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 63 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
73 mojom::GpuServiceInternalPtr gpu_service_; 64 mojom::GpuServiceInternalPtr gpu_service_;
74 mojo::BindingSet<mojom::GpuService> bindings_; 65 mojo::BindingSet<mojom::GpuService> bindings_;
75 gpu::GPUInfo gpu_info_; 66 gpu::GPUInfo gpu_info_;
76 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
77 base::WaitableEvent shutdown_event_;
78 std::unique_ptr<base::Thread> io_thread_;
79 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_;
80 GpuMain gpu_main_; 67 GpuMain gpu_main_;
81 68
82 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); 69 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy);
83 }; 70 };
84 71
85 } // namespace ws 72 } // namespace ws
86 } // namespace ui 73 } // namespace ui
87 74
88 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ 75 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698