Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 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" |
Dave Tapuska | 0c34943 | 2025-03-25 23:56:45 | [diff] [blame] | 10 | #include "build/build_config.h" |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 11 | #include "content/common/content_export.h" |
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 12 | #include "content/common/in_process_child_thread_params.h" |
Jonathan Backer | 0af50996 | 2018-05-30 16:05:07 | [diff] [blame] | 13 | #include "gpu/config/gpu_preferences.h" |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 14 | |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 15 | namespace content { |
16 | |||||
Joe Mason | 94bebf1 | 2022-06-03 15:03:53 | [diff] [blame] | 17 | class ChildProcess; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 18 | |
19 | // This class creates a GPU thread (instead of a GPU process), when running | ||||
20 | // with --in-process-gpu or --single-process. | ||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 21 | class InProcessGpuThread : public base::Thread { |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 22 | public: |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 23 | explicit InProcessGpuThread(const InProcessChildThreadParams& params, |
24 | const gpu::GpuPreferences& gpu_preferences); | ||||
Peter Boström | 828b902 | 2021-09-21 02:28:43 | [diff] [blame] | 25 | |
26 | InProcessGpuThread(const InProcessGpuThread&) = delete; | ||||
27 | InProcessGpuThread& operator=(const InProcessGpuThread&) = delete; | ||||
28 | |||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 29 | ~InProcessGpuThread() override; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 30 | |
31 | protected: | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 32 | void Init() override; |
33 | void CleanUp() override; | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 34 | |
35 | private: | ||||
Gyuyoung Kim | e40dc1e2 | 2025-04-03 14:52:52 | [diff] [blame] | 36 | #if BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_IOS_TVOS) |
Dave Tapuska | 0c34943 | 2025-03-25 23:56:45 | [diff] [blame] | 37 | class BELayerHierarchyTransportImpl; |
38 | #endif | ||||
39 | |||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 40 | InProcessChildThreadParams params_; |
41 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 42 | // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
Ali Hijazi | 1b1fb43 | 2022-08-03 10:45:37 | [diff] [blame] | 43 | std::unique_ptr<ChildProcess> gpu_process_; |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 44 | gpu::GpuPreferences gpu_preferences_; |
Gyuyoung Kim | e40dc1e2 | 2025-04-03 14:52:52 | [diff] [blame] | 45 | #if BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_IOS_TVOS) |
Dave Tapuska | 0c34943 | 2025-03-25 23:56:45 | [diff] [blame] | 46 | std::unique_ptr<BELayerHierarchyTransportImpl> be_layer_transport_; |
47 | #endif | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 48 | }; |
49 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 50 | CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 51 | const InProcessChildThreadParams& params, |
52 | const gpu::GpuPreferences& gpu_preferences); | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 53 | |
54 | } // namespace content | ||||
55 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 56 | #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |