[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 | |
8 | #include "base/threading/thread.h" | ||||
9 | #include "content/common/content_export.h" | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 10 | #include "content/common/in_process_child_thread_params.h" |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 11 | |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame^] | 12 | namespace gpu { |
13 | class SyncPointManager; | ||||
14 | } | ||||
15 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 16 | namespace content { |
17 | |||||
grt | 8c64842 | 2015-06-29 18:17:17 | [diff] [blame] | 18 | class GpuMemoryBufferFactory; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 19 | class GpuProcess; |
20 | |||||
21 | // This class creates a GPU thread (instead of a GPU process), when running | ||||
22 | // with --in-process-gpu or --single-process. | ||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 23 | class InProcessGpuThread : public base::Thread { |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 24 | public: |
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame^] | 25 | InProcessGpuThread(const InProcessChildThreadParams& params, |
26 | gpu::SyncPointManager* sync_point_manager_override); | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 27 | ~InProcessGpuThread() override; |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 28 | |
29 | protected: | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 30 | void Init() override; |
31 | void CleanUp() override; | ||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 32 | |
33 | private: | ||||
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 34 | InProcessChildThreadParams params_; |
35 | |||||
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 36 | // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
37 | GpuProcess* gpu_process_; | ||||
38 | |||||
boliu | c5befe7 | 2015-07-21 19:08:56 | [diff] [blame^] | 39 | // Can be null if overridden. |
40 | scoped_ptr<gpu::SyncPointManager> sync_point_manager_; | ||||
41 | |||||
42 | // Non-owning. | ||||
43 | gpu::SyncPointManager* sync_point_manager_override_; | ||||
44 | |||||
grt | 8c64842 | 2015-06-29 18:17:17 | [diff] [blame] | 45 | scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
46 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 47 | DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 48 | }; |
49 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 50 | CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
morrita | c6238ab | 2015-03-18 01:48:29 | [diff] [blame] | 51 | const InProcessChildThreadParams& params); |
[email protected] | d7a2d89 | 2013-08-16 07:45:36 | [diff] [blame] | 52 | |
53 | } // namespace content | ||||
54 | |||||
[email protected] | 8707caa | 2013-09-04 16:41:30 | [diff] [blame] | 55 | #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |