| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | 5 #ifndef CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
| 6 #define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | 6 #define CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/in_process_child_thread_params.h" | 11 #include "content/common/in_process_child_thread_params.h" |
| 12 | 12 |
| 13 namespace gpu { | 13 namespace gpu { |
| 14 struct GpuPreferences; |
| 14 class SyncPointManager; | 15 class SyncPointManager; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 class GpuMemoryBufferFactory; | 20 class GpuMemoryBufferFactory; |
| 20 class GpuProcess; | 21 class GpuProcess; |
| 21 | 22 |
| 22 // This class creates a GPU thread (instead of a GPU process), when running | 23 // This class creates a GPU thread (instead of a GPU process), when running |
| 23 // with --in-process-gpu or --single-process. | 24 // with --in-process-gpu or --single-process. |
| 24 class InProcessGpuThread : public base::Thread { | 25 class InProcessGpuThread : public base::Thread { |
| 25 public: | 26 public: |
| 26 InProcessGpuThread(const InProcessChildThreadParams& params, | 27 InProcessGpuThread(const InProcessChildThreadParams& params, |
| 28 const gpu::GpuPreferences* gpu_preferences, |
| 27 gpu::SyncPointManager* sync_point_manager_override); | 29 gpu::SyncPointManager* sync_point_manager_override); |
| 28 ~InProcessGpuThread() override; | 30 ~InProcessGpuThread() override; |
| 29 | 31 |
| 30 protected: | 32 protected: |
| 31 void Init() override; | 33 void Init() override; |
| 32 void CleanUp() override; | 34 void CleanUp() override; |
| 33 | 35 |
| 34 private: | 36 private: |
| 35 InProcessChildThreadParams params_; | 37 InProcessChildThreadParams params_; |
| 36 | 38 |
| 37 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. | 39 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. |
| 38 GpuProcess* gpu_process_; | 40 GpuProcess* gpu_process_; |
| 39 | 41 |
| 42 const gpu::GpuPreferences* const gpu_preferences_; |
| 43 |
| 40 // Can be null if overridden. | 44 // Can be null if overridden. |
| 41 scoped_ptr<gpu::SyncPointManager> sync_point_manager_; | 45 scoped_ptr<gpu::SyncPointManager> sync_point_manager_; |
| 42 | 46 |
| 43 // Non-owning. | 47 // Non-owning. |
| 44 gpu::SyncPointManager* sync_point_manager_override_; | 48 gpu::SyncPointManager* sync_point_manager_override_; |
| 45 | 49 |
| 46 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 50 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
| 47 | 51 |
| 48 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); | 52 DISALLOW_COPY_AND_ASSIGN(InProcessGpuThread); |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( | 55 CONTENT_EXPORT base::Thread* CreateInProcessGpuThread( |
| 52 const InProcessChildThreadParams& params); | 56 const InProcessChildThreadParams& params); |
| 53 | 57 |
| 54 } // namespace content | 58 } // namespace content |
| 55 | 59 |
| 56 #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ | 60 #endif // CONTENT_GPU_IN_PROCESS_GPU_THREAD_H_ |
| OLD | NEW |