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 SERVICES_UI_WS_GPU_HOST_H_ | 5 #ifndef SERVICES_UI_WS_GPU_HOST_H_ |
6 #define SERVICES_UI_WS_GPU_HOST_H_ | 6 #define SERVICES_UI_WS_GPU_HOST_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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // Sets up connection from clients to the real service implementation in the GPU | 28 // Sets up connection from clients to the real service implementation in the GPU |
29 // process. | 29 // process. |
30 class GpuHost : public mojom::GpuHost { | 30 class GpuHost : public mojom::GpuHost { |
31 public: | 31 public: |
32 explicit GpuHost(GpuHostDelegate* delegate); | 32 explicit GpuHost(GpuHostDelegate* delegate); |
33 ~GpuHost() override; | 33 ~GpuHost() override; |
34 | 34 |
35 void Add(mojom::GpuRequest request); | 35 void Add(mojom::GpuRequest request); |
36 | 36 |
| 37 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); |
| 38 void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget); |
| 39 |
37 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu. | 40 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu. |
38 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, | 41 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, |
39 cc::mojom::DisplayCompositorClientPtr client); | 42 cc::mojom::DisplayCompositorClientPtr client); |
40 | 43 |
41 private: | 44 private: |
| 45 void OnBadMessageFromGpu(); |
| 46 |
42 // mojom::GpuHost: | 47 // mojom::GpuHost: |
43 void DidInitialize(const gpu::GPUInfo& gpu_info) override; | 48 void DidInitialize(const gpu::GPUInfo& gpu_info) override; |
44 void DidCreateOffscreenContext(const GURL& url) override; | 49 void DidCreateOffscreenContext(const GURL& url) override; |
45 void DidDestroyOffscreenContext(const GURL& url) override; | 50 void DidDestroyOffscreenContext(const GURL& url) override; |
46 void DidDestroyChannel(int32_t client_id) override; | 51 void DidDestroyChannel(int32_t client_id) override; |
47 void DidLoseContext(bool offscreen, | 52 void DidLoseContext(bool offscreen, |
48 gpu::error::ContextLostReason reason, | 53 gpu::error::ContextLostReason reason, |
49 const GURL& active_url) override; | 54 const GURL& active_url) override; |
| 55 void SetChildSurface(gpu::SurfaceHandle parent, |
| 56 gpu::SurfaceHandle child) override; |
50 void StoreShaderToDisk(int32_t client_id, | 57 void StoreShaderToDisk(int32_t client_id, |
51 const std::string& key, | 58 const std::string& key, |
52 const std::string& shader) override; | 59 const std::string& shader) override; |
53 | 60 |
54 GpuHostDelegate* const delegate_; | 61 GpuHostDelegate* const delegate_; |
55 int32_t next_client_id_; | 62 int32_t next_client_id_; |
56 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 63 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
57 mojom::GpuServicePtr gpu_service_; | 64 mojom::GpuServicePtr gpu_service_; |
58 mojo::Binding<mojom::GpuHost> gpu_host_binding_; | 65 mojo::Binding<mojom::GpuHost> gpu_host_binding_; |
59 gpu::GPUInfo gpu_info_; | 66 gpu::GPUInfo gpu_info_; |
60 std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 67 std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
61 | 68 |
62 mojom::GpuMainPtr gpu_main_; | 69 mojom::GpuMainPtr gpu_main_; |
63 | 70 |
64 // TODO(fsamuel): GpuHost should not be holding onto |gpu_main_impl| | 71 // TODO(fsamuel): GpuHost should not be holding onto |gpu_main_impl| |
65 // because that will live in another process soon. | 72 // because that will live in another process soon. |
66 std::unique_ptr<GpuMain> gpu_main_impl_; | 73 std::unique_ptr<GpuMain> gpu_main_impl_; |
67 | 74 |
68 DISALLOW_COPY_AND_ASSIGN(GpuHost); | 75 DISALLOW_COPY_AND_ASSIGN(GpuHost); |
69 }; | 76 }; |
70 | 77 |
71 } // namespace ws | 78 } // namespace ws |
72 } // namespace ui | 79 } // namespace ui |
73 | 80 |
74 #endif // SERVICES_UI_WS_GPU_HOST_H_ | 81 #endif // SERVICES_UI_WS_GPU_HOST_H_ |
OLD | NEW |