[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 5 | #ifndef CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
6 | #define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 7 | |
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 8 | #include "base/memory/raw_ptr.h" |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 9 | #include "base/threading/thread.h" |
10 | #include "content/common/content_export.h" | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 11 | #include "content/common/in_process_child_thread_params.h" |
Jonathan Backer | 0af50996 | 2018-05-30 16:05:07 | [diff] [blame] | 12 | #include "gpu/config/gpu_preferences.h" |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 13 | |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 14 | namespace content { |
15 | |||||
Joe Mason | 94bebf1 | 2022-06-03 15:03:53 | [diff] [blame^] | 16 | class ChildProcess; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 17 | |
18 | // This class creates a GPU thread (instead of a GPU process), when running | ||||
19 | // with --in-process-gpu or --single-process. | ||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 20 | class InProcessGpuThread : public base::Thread { |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 21 | public: |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 22 | explicit InProcessGpuThread(const InProcessChildThreadParams& params, |
23 | const gpu::GpuPreferences& gpu_preferences); | ||||
Peter Boström | 828b902 | 2021-09-21 02:28:43 | [diff] [blame] | 24 | |
25 | InProcessGpuThread(const InProcessGpuThread&) = delete; | ||||
26 | InProcessGpuThread& operator=(const InProcessGpuThread&) = delete; | ||||
27 | |||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 28 | ~InProcessGpuThread() override; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 29 | |
30 | protected: | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 31 | void Init() override; |
32 | void CleanUp() override; | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 33 | |
34 | private: | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 35 | InProcessChildThreadParams params_; |
36 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 37 | // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
Joe Mason | 94bebf1 | 2022-06-03 15:03:53 | [diff] [blame^] | 38 | raw_ptr<ChildProcess> gpu_process_; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 39 | |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 40 | gpu::GpuPreferences gpu_preferences_; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 41 | }; |
42 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 43 | CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 44 | const InProcessChildThreadParams& params, |
45 | const gpu::GpuPreferences& gpu_preferences); | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 46 | |
47 | } // namespace content | ||||
48 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 49 | #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |