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 #ifndef CONTENT_BROWSER_GPU_GPU_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_CLIENT_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_CLIENT_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_CLIENT_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/browser/gpu/gpu_process_host.h" |
9 #include "ipc/ipc_channel_handle.h" | 10 #include "ipc/ipc_channel_handle.h" |
10 #include "mojo/public/cpp/bindings/binding_set.h" | 11 #include "mojo/public/cpp/bindings/binding_set.h" |
11 #include "services/ui/public/interfaces/gpu.mojom.h" | 12 #include "services/ui/public/interfaces/gpu.mojom.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class GpuClient : public ui::mojom::Gpu { | 16 class GpuClient : public ui::mojom::Gpu { |
16 public: | 17 public: |
17 explicit GpuClient(int render_process_id); | 18 explicit GpuClient(int render_process_id); |
18 ~GpuClient() override; | 19 ~GpuClient() override; |
19 | 20 |
20 void Add(ui::mojom::GpuRequest request); | 21 void Add(ui::mojom::GpuRequest request); |
21 | 22 |
22 private: | 23 private: |
23 void OnError(); | 24 void OnError(); |
24 void OnEstablishGpuChannel(const EstablishGpuChannelCallback& callback, | 25 void OnEstablishGpuChannel(const EstablishGpuChannelCallback& callback, |
25 const IPC::ChannelHandle& channel, | 26 const IPC::ChannelHandle& channel, |
26 const gpu::GPUInfo& gpu_info); | 27 const gpu::GPUInfo& gpu_info, |
| 28 GpuProcessHost::EstablishChannelStatus status); |
27 void OnCreateGpuMemoryBuffer(const CreateGpuMemoryBufferCallback& callback, | 29 void OnCreateGpuMemoryBuffer(const CreateGpuMemoryBufferCallback& callback, |
28 const gfx::GpuMemoryBufferHandle& handle); | 30 const gfx::GpuMemoryBufferHandle& handle); |
29 | 31 |
30 // ui::mojom::Gpu overrides: | 32 // ui::mojom::Gpu overrides: |
31 void EstablishGpuChannel( | 33 void EstablishGpuChannel( |
32 const EstablishGpuChannelCallback& callback) override; | 34 const EstablishGpuChannelCallback& callback) override; |
33 void CreateGpuMemoryBuffer( | 35 void CreateGpuMemoryBuffer( |
34 gfx::GpuMemoryBufferId id, | 36 gfx::GpuMemoryBufferId id, |
35 const gfx::Size& size, | 37 const gfx::Size& size, |
36 gfx::BufferFormat format, | 38 gfx::BufferFormat format, |
37 gfx::BufferUsage usage, | 39 gfx::BufferUsage usage, |
38 const ui::mojom::Gpu::CreateGpuMemoryBufferCallback& callback) override; | 40 const ui::mojom::Gpu::CreateGpuMemoryBufferCallback& callback) override; |
39 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 41 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
40 const gpu::SyncToken& sync_token) override; | 42 const gpu::SyncToken& sync_token) override; |
41 | 43 |
42 const int render_process_id_; | 44 const int render_process_id_; |
43 mojo::BindingSet<ui::mojom::Gpu> bindings_; | 45 mojo::BindingSet<ui::mojom::Gpu> bindings_; |
44 base::WeakPtrFactory<GpuClient> weak_factory_; | 46 base::WeakPtrFactory<GpuClient> weak_factory_; |
45 | 47 |
46 DISALLOW_COPY_AND_ASSIGN(GpuClient); | 48 DISALLOW_COPY_AND_ASSIGN(GpuClient); |
47 }; | 49 }; |
48 | 50 |
49 } // namespace content | 51 } // namespace content |
50 | 52 |
51 #endif // CONTENT_BROWSER_GPU_GPU_CLIENT_H_ | 53 #endif // CONTENT_BROWSER_GPU_GPU_CLIENT_H_ |
OLD | NEW |