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" | |
15 | |
16 namespace gpu { | |
17 class GpuMemoryBufferFactory; | |
18 struct GpuPreferences; | |
19 } | |
20 | 14 |
21 namespace content { | 15 namespace content { |
22 | 16 |
23 class GpuProcess; | 17 class GpuProcess; |
24 | 18 |
25 // This class creates a GPU thread (instead of a GPU process), when running | 19 // This class creates a GPU thread (instead of a GPU process), when running |
26 // with --in-process-gpu or --single-process. | 20 // with --in-process-gpu or --single-process. |
27 class InProcessGpuThread : public base::Thread { | 21 class InProcessGpuThread : public base::Thread { |
28 public: | 22 public: |
29 InProcessGpuThread(const InProcessChildThreadParams& params, | 23 explicit InProcessGpuThread(const InProcessChildThreadParams& params); |
30 const gpu::GpuPreferences& gpu_preferences); | |
31 ~InProcessGpuThread() override; | 24 ~InProcessGpuThread() override; |
32 | 25 |
33 protected: | 26 protected: |
34 void Init() override; | 27 void Init() override; |
35 void CleanUp() override; | 28 void CleanUp() override; |
36 | 29 |
37 private: | 30 private: |
38 InProcessChildThreadParams params_; | 31 InProcessChildThreadParams params_; |
39 | 32 |
40 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. | 33 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
41 GpuProcess* gpu_process_; | 34 GpuProcess* gpu_process_; |
42 | 35 |
43 const gpu::GpuPreferences gpu_preferences_; | |
44 | |
45 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); | 36 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); |
48 }; | 37 }; |
49 | 38 |
50 CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( | 39 CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
51 const InProcessChildThreadParams& params, | 40 const InProcessChildThreadParams& params); |
52 const gpu::GpuPreferences& gpu_preferences); | |
53 | 41 |
54 } // namespace content | 42 } // namespace content |
55 | 43 |
56 #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | 44 #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
OLD | NEW |