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_GPU_GPU_MAIN_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_MAIN_H_ |
6 #define SERVICES_UI_GPU_GPU_MAIN_H_ | 6 #define SERVICES_UI_GPU_GPU_MAIN_H_ |
7 | 7 |
| 8 #include "base/threading/thread.h" |
8 #include "gpu/ipc/service/gpu_init.h" | 9 #include "gpu/ipc/service/gpu_init.h" |
9 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" | 10 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" |
10 | 11 |
11 namespace gpu { | 12 namespace gpu { |
12 class GpuMemoryBufferFactory; | 13 class GpuMemoryBufferFactory; |
13 } | 14 } |
14 | 15 |
15 namespace ui { | 16 namespace ui { |
16 | 17 |
17 class GpuServiceInternal; | 18 class GpuServiceInternal; |
18 | 19 |
19 class GpuMain : public gpu::GpuSandboxHelper { | 20 class GpuMain : public gpu::GpuSandboxHelper { |
20 public: | 21 public: |
21 GpuMain(); | 22 GpuMain(); |
22 ~GpuMain() override; | 23 ~GpuMain() override; |
23 | 24 |
24 void Add(mojom::GpuServiceInternalRequest request); | 25 void OnStart(); |
| 26 void Create(mojom::GpuServiceInternalRequest request); |
25 | 27 |
26 GpuServiceInternal* gpu_service() { return gpu_service_internal_.get(); } | 28 GpuServiceInternal* gpu_service() { return gpu_service_internal_.get(); } |
27 | 29 |
28 private: | 30 private: |
| 31 void InitOnGpuThread(); |
| 32 void TearDownOnGpuThread(); |
| 33 void CreateOnGpuThread(mojom::GpuServiceInternalRequest request); |
| 34 |
29 // gpu::GpuSandboxHelper: | 35 // gpu::GpuSandboxHelper: |
30 void PreSandboxStartup() override; | 36 void PreSandboxStartup() override; |
31 bool EnsureSandboxInitialized() override; | 37 bool EnsureSandboxInitialized() override; |
32 | 38 |
| 39 std::unique_ptr<gpu::GpuInit> gpu_init_; |
33 std::unique_ptr<GpuServiceInternal> gpu_service_internal_; | 40 std::unique_ptr<GpuServiceInternal> gpu_service_internal_; |
34 gpu::GpuInit gpu_init_; | |
35 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 41 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
36 | 42 |
| 43 // The main thread for GpuService. |
| 44 base::Thread gpu_thread_; |
| 45 |
| 46 // The thread that handles IO events for GpuService. |
| 47 base::Thread io_thread_; |
| 48 |
| 49 base::WeakPtrFactory<GpuMain> weak_factory_; |
| 50 |
37 DISALLOW_COPY_AND_ASSIGN(GpuMain); | 51 DISALLOW_COPY_AND_ASSIGN(GpuMain); |
38 }; | 52 }; |
39 | 53 |
40 } // namespace ui | 54 } // namespace ui |
41 | 55 |
42 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ | 56 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ |
OLD | NEW |