blob: 6124ba86f6cfba4f55fefd2eccb11ed817117958 [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
avi66a07722015-12-25 23:38:128#include "base/macros.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"
penghuang7404df9882016-02-29 23:07:2912#include "gpu/command_buffer/service/gpu_preferences.h"
[email protected]d7a2d892013-08-16 07:45:3613
boliuc5befe72015-07-21 19:08:5614namespace gpu {
penghuang7404df9882016-02-29 23:07:2915struct GpuPreferences;
boliuc5befe72015-07-21 19:08:5616class SyncPointManager;
17}
18
[email protected]d7a2d892013-08-16 07:45:3619namespace content {
20
grt8c648422015-06-29 18:17:1721class GpuMemoryBufferFactory;
[email protected]d7a2d892013-08-16 07:45:3622class GpuProcess;
23
24// This class creates a GPU thread (instead of a GPU process), when running
25// with --in-process-gpu or --single-process.
[email protected]8707caa2013-09-04 16:41:3026class InProcessGpuThread : public base::Thread {
[email protected]d7a2d892013-08-16 07:45:3627 public:
boliuc5befe72015-07-21 19:08:5628 InProcessGpuThread(const InProcessChildThreadParams& params,
penghuang7404df9882016-02-29 23:07:2929 const gpu::GpuPreferences& gpu_preferences,
boliuc5befe72015-07-21 19:08:5630 gpu::SyncPointManager* sync_point_manager_override);
dchenge933b3e2014-10-21 11:44:0931 ~InProcessGpuThread() override;
[email protected]d7a2d892013-08-16 07:45:3632
33 protected:
dchenge933b3e2014-10-21 11:44:0934 void Init() override;
35 void CleanUp() override;
[email protected]d7a2d892013-08-16 07:45:3636
37 private:
morritac6238ab2015-03-18 01:48:2938 InProcessChildThreadParams params_;
39
[email protected]d7a2d892013-08-16 07:45:3640 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers.
41 GpuProcess* gpu_process_;
42
penghuang7404df9882016-02-29 23:07:2943 const gpu::GpuPreferences gpu_preferences_;
44
boliuc5befe72015-07-21 19:08:5645 // Can be null if overridden.
46 scoped_ptr<gpu::SyncPointManager> sync_point_manager_;
47
48 // Non-owning.
49 gpu::SyncPointManager* sync_point_manager_override_;
50
grt8c648422015-06-29 18:17:1751 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
52
[email protected]8707caa2013-09-04 16:41:3053 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread);
[email protected]d7a2d892013-08-16 07:45:3654};
55
[email protected]8707caa2013-09-04 16:41:3056CONTENT_EXPORT base::Thread* CreateInProcessGpuThread(
penghuang2084d992016-03-10 03:32:5757 const InProcessChildThreadParams& params,
58 const gpu::GpuPreferences& gpu_preferences);
[email protected]d7a2d892013-08-16 07:45:3659
60} // namespace content
61
[email protected]8707caa2013-09-04 16:41:3062#endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_