[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 1 | // 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] | 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 | |
dcheng | 6003e0b | 2016-04-09 18:42:34 | [diff] [blame] | 8 | #include <memory> |
9 | |||||
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 10 | #include "base/macros.h" |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 11 | #include "base/threading/thread.h" |
12 | #include "content/common/content_export.h" | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 13 | #include "content/common/in_process_child_thread_params.h" |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 14 | #include "gpu/command_buffer/service/gpu_preferences.h" |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 15 | |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 16 | namespace content { |
17 | |||||
18 | class 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] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 22 | class InProcessGpuThread : public base::Thread { |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 23 | public: |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 24 | explicit InProcessGpuThread(const InProcessChildThreadParams& params, |
25 | const gpu::GpuPreferences& gpu_preferences); | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 26 | ~InProcessGpuThread() override; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 27 | |
28 | protected: | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 29 | void Init() override; |
30 | void CleanUp() override; | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 31 | |
32 | private: | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 33 | InProcessChildThreadParams params_; |
34 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 35 | // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
36 | GpuProcess* gpu_process_; | ||||
37 | |||||
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 38 | gpu::GpuPreferences gpu_preferences_; |
39 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 40 | DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 41 | }; |
42 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 43 | CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
Zhenyao Mo | 83b895e | 2017-10-18 18:50:54 | [diff] [blame] | 44 | const InProcessChildThreadParams& params, |
45 | const gpu::GpuPreferences& gpu_preferences); | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 46 | |
47 | } // namespace content | ||||
48 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 49 | #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |