blob: a97445dea4c23a58fb11e622331ed42b166ecc7f [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2013 The Chromium Authors
[email protected]d7a2d892013-08-16 07:45:362// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]8707caa2013-09-04 16:41:305#ifndef CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_
6#define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_
[email protected]d7a2d892013-08-16 07:45:367
Keishi Hattori0e45c022021-11-27 09:25:528#include "base/memory/raw_ptr.h"
[email protected]d7a2d892013-08-16 07:45:369#include "base/threading/thread.h"
Dave Tapuska0c349432025-03-25 23:56:4510#include "build/build_config.h"
[email protected]d7a2d892013-08-16 07:45:3611#include "content/common/content_export.h"
morritac6238ab2015-03-18 01:48:2912#include "content/common/in_process_child_thread_params.h"
Jonathan Backer0af509962018-05-30 16:05:0713#include "gpu/config/gpu_preferences.h"
boliuc5befe72015-07-21 19:08:5614
[email protected]d7a2d892013-08-16 07:45:3615namespace content {
16
Joe Mason94bebf12022-06-03 15:03:5317class ChildProcess;
[email protected]d7a2d892013-08-16 07:45:3618
19// This class creates a GPU thread (instead of a GPU process), when running
20// with --in-process-gpu or --single-process.
[email protected]8707caa2013-09-04 16:41:3021class InProcessGpuThread : public base::Thread {
[email protected]d7a2d892013-08-16 07:45:3622 public:
Zhenyao Mo83b895e2017-10-18 18:50:5423 explicit InProcessGpuThread(const InProcessChildThreadParams& params,
24 const gpu::GpuPreferences& gpu_preferences);
Peter Boström828b9022021-09-21 02:28:4325
26 InProcessGpuThread(const InProcessGpuThread&) = delete;
27 InProcessGpuThread& operator=(const InProcessGpuThread&) = delete;
28
dchenge933b3e2014-10-21 11:44:0929 ~InProcessGpuThread() override;
[email protected]d7a2d892013-08-16 07:45:3630
31 protected:
dchenge933b3e2014-10-21 11:44:0932 void Init() override;
33 void CleanUp() override;
[email protected]d7a2d892013-08-16 07:45:3634
35 private:
Gyuyoung Kime40dc1e22025-04-03 14:52:5236#if BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_IOS_TVOS)
Dave Tapuska0c349432025-03-25 23:56:4537 class BELayerHierarchyTransportImpl;
38#endif
39
morritac6238ab2015-03-18 01:48:2940 InProcessChildThreadParams params_;
41
[email protected]d7a2d892013-08-16 07:45:3642 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers.
Ali Hijazi1b1fb432022-08-03 10:45:3743 std::unique_ptr<ChildProcess> gpu_process_;
Zhenyao Mo83b895e2017-10-18 18:50:5444 gpu::GpuPreferences gpu_preferences_;
Gyuyoung Kime40dc1e22025-04-03 14:52:5245#if BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_IOS_TVOS)
Dave Tapuska0c349432025-03-25 23:56:4546 std::unique_ptr<BELayerHierarchyTransportImpl> be_layer_transport_;
47#endif
[email protected]d7a2d892013-08-16 07:45:3648};
49
[email protected]8707caa2013-09-04 16:41:3050CONTENT_EXPORT base::Thread* CreateInProcessGpuThread(
Zhenyao Mo83b895e2017-10-18 18:50:5451 const InProcessChildThreadParams& params,
52 const gpu::GpuPreferences& gpu_preferences);
[email protected]d7a2d892013-08-16 07:45:3653
54} // namespace content
55
[email protected]8707caa2013-09-04 16:41:3056#endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_