blob: 8681b30d394a641c39ba06fbdaf4076c6380c0ce [file] [log] [blame]
[email protected]d7a2d892013-08-16 07:45:361// 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]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"
10#include "content/common/content_export.h"
morritac6238ab2015-03-18 01:48:2911#include "content/common/in_process_child_thread_params.h"
Jonathan Backer0af509962018-05-30 16:05:0712#include "gpu/config/gpu_preferences.h"
boliuc5befe72015-07-21 19:08:5613
[email protected]d7a2d892013-08-16 07:45:3614namespace content {
15
Joe Mason94bebf12022-06-03 15:03:5316class ChildProcess;
[email protected]d7a2d892013-08-16 07:45:3617
18// This class creates a GPU thread (instead of a GPU process), when running
19// with --in-process-gpu or --single-process.
[email protected]8707caa2013-09-04 16:41:3020class InProcessGpuThread : public base::Thread {
[email protected]d7a2d892013-08-16 07:45:3621 public:
Zhenyao Mo83b895e2017-10-18 18:50:5422 explicit InProcessGpuThread(const InProcessChildThreadParams& params,
23 const gpu::GpuPreferences& gpu_preferences);
Peter Boström828b9022021-09-21 02:28:4324
25 InProcessGpuThread(const InProcessGpuThread&) = delete;
26 InProcessGpuThread& operator=(const InProcessGpuThread&) = delete;
27
dchenge933b3e2014-10-21 11:44:0928 ~InProcessGpuThread() override;
[email protected]d7a2d892013-08-16 07:45:3629
30 protected:
dchenge933b3e2014-10-21 11:44:0931 void Init() override;
32 void CleanUp() override;
[email protected]d7a2d892013-08-16 07:45:3633
34 private:
morritac6238ab2015-03-18 01:48:2935 InProcessChildThreadParams params_;
36
[email protected]d7a2d892013-08-16 07:45:3637 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers.
Joe Mason94bebf12022-06-03 15:03:5338 raw_ptr<ChildProcess> gpu_process_;
[email protected]d7a2d892013-08-16 07:45:3639
Zhenyao Mo83b895e2017-10-18 18:50:5440 gpu::GpuPreferences gpu_preferences_;
[email protected]d7a2d892013-08-16 07:45:3641};
42
[email protected]8707caa2013-09-04 16:41:3043CONTENT_EXPORT base::Thread* CreateInProcessGpuThread(
Zhenyao Mo83b895e2017-10-18 18:50:5444 const InProcessChildThreadParams& params,
45 const gpu::GpuPreferences& gpu_preferences);
[email protected]d7a2d892013-08-16 07:45:3646
47} // namespace content
48
[email protected]8707caa2013-09-04 16:41:3049#endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_