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

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

Issue 2448983003: gpu: Refactor memory buffer handling code out of content.
Patch Set: . 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
« no previous file with comments | « services/ui/public/interfaces/gpu_service.mojom ('k') | services/ui/ws/gpu_service_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gpu/ipc/client/gpu_host_memory_buffer_manager.h"
13 #include "mojo/public/cpp/bindings/binding_set.h" 14 #include "mojo/public/cpp/bindings/binding_set.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 15 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "services/ui/gpu/gpu_main.h" 16 #include "services/ui/gpu/gpu_main.h"
16 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" 17 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
17 #include "services/ui/public/interfaces/gpu_memory_buffer.mojom.h" 18 #include "services/ui/public/interfaces/gpu_memory_buffer.mojom.h"
18 #include "services/ui/public/interfaces/gpu_service.mojom.h" 19 #include "services/ui/public/interfaces/gpu_service.mojom.h"
19 20
20 namespace gpu { 21 namespace gpu {
21 class GpuChannelHost; 22 class GpuChannelHost;
22 } 23 }
23 24
24 namespace ui { 25 namespace ui {
25 26
26 class GpuServiceInternal; 27 class GpuServiceInternal;
27 28
28 namespace ws { 29 namespace ws {
29 30
30 class GpuServiceProxyDelegate; 31 class GpuServiceProxyDelegate;
31 class MusGpuMemoryBufferManager; 32 class MusGpuMemoryBufferManager;
32 33
33 // The proxy implementation that relays requests from clients to the real 34 // The proxy implementation that relays requests from clients to the real
34 // service implementation in the GPU process over mojom.GpuServiceInternal. 35 // service implementation in the GPU process over mojom.GpuServiceInternal.
35 class GpuServiceProxy : public mojom::GpuService, 36 class GpuServiceProxy : public gpu::GpuChannelHostFactory {
36 public gpu::GpuChannelHostFactory {
37 public: 37 public:
38 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); 38 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate);
39 ~GpuServiceProxy() override; 39 ~GpuServiceProxy() override;
40 40
41 void Add(mojom::GpuServiceRequest request); 41 void Add(mojom::GpuServiceRequest request);
42 42
43 private: 43 private:
44 void OnInitialized(const gpu::GPUInfo& gpu_info); 44 void OnInitialized(const gpu::GPUInfo& gpu_info);
45 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback,
46 int32_t client_id,
47 mojo::ScopedMessagePipeHandle channel_handle);
48 void OnInternalGpuChannelEstablished( 45 void OnInternalGpuChannelEstablished(
49 mojo::ScopedMessagePipeHandle channel_handle); 46 mojo::ScopedMessagePipeHandle channel_handle);
50 47
51 // mojom::GpuService overrides:
52 void EstablishGpuChannel(
53 const EstablishGpuChannelCallback& callback) override;
54 void CreateGpuMemoryBuffer(
55 gfx::GpuMemoryBufferId id,
56 const gfx::Size& size,
57 gfx::BufferFormat format,
58 gfx::BufferUsage usage,
59 uint64_t surface_id,
60 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback)
61 override;
62 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
63 const gpu::SyncToken& sync_token) override;
64
65 // gpu::GpuChannelHostFactory overrides: 48 // gpu::GpuChannelHostFactory overrides:
66 bool IsMainThread() override; 49 bool IsMainThread() override;
67 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; 50 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
68 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( 51 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
69 size_t size) override; 52 size_t size) override;
70 53
71 GpuServiceProxyDelegate* delegate_; 54 GpuServiceProxyDelegate* delegate_;
72 int32_t next_client_id_; 55 int32_t next_client_id_;
73 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 56 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
74 mojom::GpuServiceInternalPtr gpu_service_; 57 mojom::GpuServiceInternalPtr gpu_service_;
75 mojo::BindingSet<mojom::GpuService> bindings_;
76 gpu::GPUInfo gpu_info_; 58 gpu::GPUInfo gpu_info_;
59 std::unique_ptr<gpu::GpuHostMemoryBufferManager> gpu_memory_buffer_manager_;
77 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 60 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
78 base::WaitableEvent shutdown_event_; 61 base::WaitableEvent shutdown_event_;
79 std::unique_ptr<base::Thread> io_thread_; 62 std::unique_ptr<base::Thread> io_thread_;
80 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_; 63 // std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_;
81 GpuMain gpu_main_; 64 GpuMain gpu_main_;
82 65
83 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); 66 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy);
84 }; 67 };
85 68
86 } // namespace ws 69 } // namespace ws
87 } // namespace ui 70 } // namespace ui
88 71
89 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ 72 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/gpu_service.mojom ('k') | services/ui/ws/gpu_service_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698