OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_GPU_IN_PROCESS_GPU_THREAD_H_ | 5 #ifndef CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
6 #define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | 6 #define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/common/in_process_child_thread_params.h" | 13 #include "content/common/in_process_child_thread_params.h" |
14 #include "gpu/command_buffer/service/gpu_preferences.h" | 14 #include "gpu/command_buffer/service/gpu_preferences.h" |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 class GpuMemoryBufferFactory; | 17 class GpuMemoryBufferFactory; |
18 class SyncPointManager; | |
19 struct GpuPreferences; | 18 struct GpuPreferences; |
20 } | 19 } |
21 | 20 |
22 namespace content { | 21 namespace content { |
23 | 22 |
24 class GpuProcess; | 23 class GpuProcess; |
25 | 24 |
26 // This class creates a GPU thread (instead of a GPU process), when running | 25 // This class creates a GPU thread (instead of a GPU process), when running |
27 // with --in-process-gpu or --single-process. | 26 // with --in-process-gpu or --single-process. |
28 class InProcessGpuThread : public base::Thread { | 27 class InProcessGpuThread : public base::Thread { |
29 public: | 28 public: |
30 InProcessGpuThread(const InProcessChildThreadParams& params, | 29 InProcessGpuThread(const InProcessChildThreadParams& params, |
31 const gpu::GpuPreferences& gpu_preferences, | 30 const gpu::GpuPreferences& gpu_preferences); |
32 gpu::SyncPointManager* sync_point_manager_override); | |
33 ~InProcessGpuThread() override; | 31 ~InProcessGpuThread() override; |
34 | 32 |
35 protected: | 33 protected: |
36 void Init() override; | 34 void Init() override; |
37 void CleanUp() override; | 35 void CleanUp() override; |
38 | 36 |
39 private: | 37 private: |
40 InProcessChildThreadParams params_; | 38 InProcessChildThreadParams params_; |
41 | 39 |
42 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. | 40 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
43 GpuProcess* gpu_process_; | 41 GpuProcess* gpu_process_; |
44 | 42 |
45 const gpu::GpuPreferences gpu_preferences_; | 43 const gpu::GpuPreferences gpu_preferences_; |
46 | 44 |
47 // Can be null if overridden. | |
48 std::unique_ptr<gpu::SyncPointManager> sync_point_manager_; | |
49 | |
50 // Non-owning. | |
51 gpu::SyncPointManager* sync_point_manager_override_; | |
52 | |
53 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 45 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
54 | 46 |
55 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); | 47 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); |
56 }; | 48 }; |
57 | 49 |
58 CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( | 50 CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
59 const InProcessChildThreadParams& params, | 51 const InProcessChildThreadParams& params, |
60 const gpu::GpuPreferences& gpu_preferences); | 52 const gpu::GpuPreferences& gpu_preferences); |
61 | 53 |
62 } // namespace content | 54 } // namespace content |
63 | 55 |
64 #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | 56 #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
OLD | NEW |