[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 | |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 8 | #include "base/macros.h" |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 9 | #include "base/threading/thread.h" |
10 | #include "content/common/content_export.h" | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 11 | #include "content/common/in_process_child_thread_params.h" |
penghuang | 7404df988 | 2016-02-29 23:07:29 | [diff] [blame] | 12 | #include "gpu/command_buffer/service/gpu_preferences.h" |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 13 | |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 14 | namespace gpu { |
penghuang | 7404df988 | 2016-02-29 23:07:29 | [diff] [blame] | 15 | struct GpuPreferences; |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 16 | class SyncPointManager; |
17 | } | ||||
18 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 19 | namespace content { |
20 | |||||
grt | 8c64842 | 2015-06-29 18:17:17 | [diff] [blame] | 21 | class GpuMemoryBufferFactory; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 22 | class 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] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 26 | class InProcessGpuThread : public base::Thread { |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 27 | public: |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 28 | InProcessGpuThread(const InProcessChildThreadParams& params, |
penghuang | 7404df988 | 2016-02-29 23:07:29 | [diff] [blame] | 29 | const gpu::GpuPreferences& gpu_preferences, |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 30 | gpu::SyncPointManager* sync_point_manager_override); |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 31 | ~InProcessGpuThread() override; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 32 | |
33 | protected: | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 34 | void Init() override; |
35 | void CleanUp() override; | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 36 | |
37 | private: | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 38 | InProcessChildThreadParams params_; |
39 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 40 | // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
41 | GpuProcess* gpu_process_; | ||||
42 | |||||
penghuang | 7404df988 | 2016-02-29 23:07:29 | [diff] [blame] | 43 | const gpu::GpuPreferences gpu_preferences_; |
44 | |||||
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame] | 45 | // 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 | |||||
grt | 8c64842 | 2015-06-29 18:17:17 | [diff] [blame] | 51 | scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
52 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 53 | DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 54 | }; |
55 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 56 | CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
penghuang | 2084d99 | 2016-03-10 03:32:57 | [diff] [blame^] | 57 | const InProcessChildThreadParams& params, |
58 | const gpu::GpuPreferences& gpu_preferences); | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 59 | |
60 | } // namespace content | ||||
61 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 62 | #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |