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 #include "content/gpu/in_process_gpu_thread.h" | 5 #include "content/gpu/in_process_gpu_thread.h" |
6 | 6 |
7 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 7 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
8 #include "content/gpu/gpu_child_thread.h" | 8 #include "content/gpu/gpu_child_thread.h" |
9 #include "content/gpu/gpu_process.h" | 9 #include "content/gpu/gpu_process.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 InProcessGpuThread::InProcessGpuThread(const InProcessChildThreadParams& params) | 13 InProcessGpuThread::InProcessGpuThread( |
| 14 const InProcessChildThreadParams& params, |
| 15 gpu::SyncPointManager* sync_point_manager_override) |
14 : base::Thread("Chrome_InProcGpuThread"), | 16 : base::Thread("Chrome_InProcGpuThread"), |
15 params_(params), | 17 params_(params), |
16 gpu_process_(NULL), | 18 gpu_process_(NULL), |
| 19 sync_point_manager_override_(sync_point_manager_override), |
17 gpu_memory_buffer_factory_(GpuMemoryBufferFactory::Create( | 20 gpu_memory_buffer_factory_(GpuMemoryBufferFactory::Create( |
18 GpuChildThread::GetGpuMemoryBufferFactoryType())) { | 21 GpuChildThread::GetGpuMemoryBufferFactoryType())) {} |
19 } | |
20 | 22 |
21 InProcessGpuThread::~InProcessGpuThread() { | 23 InProcessGpuThread::~InProcessGpuThread() { |
22 Stop(); | 24 Stop(); |
23 } | 25 } |
24 | 26 |
25 void InProcessGpuThread::Init() { | 27 void InProcessGpuThread::Init() { |
26 gpu_process_ = new GpuProcess(); | 28 gpu_process_ = new GpuProcess(); |
27 // The process object takes ownership of the thread object, so do not | 29 // The process object takes ownership of the thread object, so do not |
28 // save and delete the pointer. | 30 // save and delete the pointer. |
29 gpu_process_->set_main_thread( | 31 gpu_process_->set_main_thread(new GpuChildThread( |
30 new GpuChildThread(params_, gpu_memory_buffer_factory_.get())); | 32 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_)); |
31 } | 33 } |
32 | 34 |
33 void InProcessGpuThread::CleanUp() { | 35 void InProcessGpuThread::CleanUp() { |
34 SetThreadWasQuitProperly(true); | 36 SetThreadWasQuitProperly(true); |
35 delete gpu_process_; | 37 delete gpu_process_; |
36 } | 38 } |
37 | 39 |
38 base::Thread* CreateInProcessGpuThread( | 40 base::Thread* CreateInProcessGpuThread( |
39 const InProcessChildThreadParams& params) { | 41 const InProcessChildThreadParams& params) { |
40 return new InProcessGpuThread(params); | 42 return new InProcessGpuThread(params, nullptr); |
41 } | 43 } |
42 | 44 |
43 } // namespace content | 45 } // namespace content |
OLD | NEW |