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