blob: c8e96e88d479034e0f676b1276479e827020db0d [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
dcheng6003e0b2016-04-09 18:42:348#include <memory>
9
avi66a07722015-12-25 23:38:1210#include "base/macros.h"
[email protected]d7a2d892013-08-16 07:45:3611#include "base/threading/thread.h"
12#include "content/common/content_export.h"
morritac6238ab2015-03-18 01:48:2913#include "content/common/in_process_child_thread_params.h"
Zhenyao Mo83b895e2017-10-18 18:50:5414#include "gpu/command_buffer/service/gpu_preferences.h"
boliuc5befe72015-07-21 19:08:5615
[email protected]d7a2d892013-08-16 07:45:3616namespace content {
17
18class GpuProcess;
19
20// This class creates a GPU thread (instead of a GPU process), when running
21// with --in-process-gpu or --single-process.
[email protected]8707caa2013-09-04 16:41:3022class InProcessGpuThread : public base::Thread {
[email protected]d7a2d892013-08-16 07:45:3623 public:
Zhenyao Mo83b895e2017-10-18 18:50:5424 explicit InProcessGpuThread(const InProcessChildThreadParams& params,
25 const gpu::GpuPreferences& gpu_preferences);
dchenge933b3e2014-10-21 11:44:0926 ~InProcessGpuThread() override;
[email protected]d7a2d892013-08-16 07:45:3627
28 protected:
dchenge933b3e2014-10-21 11:44:0929 void Init() override;
30 void CleanUp() override;
[email protected]d7a2d892013-08-16 07:45:3631
32 private:
morritac6238ab2015-03-18 01:48:2933 InProcessChildThreadParams params_;
34
[email protected]d7a2d892013-08-16 07:45:3635 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers.
36 GpuProcess* gpu_process_;
37
Zhenyao Mo83b895e2017-10-18 18:50:5438 gpu::GpuPreferences gpu_preferences_;
39
[email protected]8707caa2013-09-04 16:41:3040 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread);
[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_