| 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 "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/gpu/gpu_child_thread.h" | 9 #include "content/gpu/gpu_child_thread.h" |
| 10 #include "content/gpu/gpu_process.h" | 10 #include "content/gpu/gpu_process.h" |
| 11 #include "gpu/config/gpu_info_collector.h" | 11 #include "gpu/config/gpu_info_collector.h" |
| 12 #include "gpu/config/gpu_util.h" |
| 12 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 13 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 13 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 14 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 14 #include "ui/gl/init/gl_factory.h" | 15 #include "ui/gl/init/gl_factory.h" |
| 15 | 16 |
| 16 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
| 17 #include "base/android/jni_android.h" | 18 #include "base/android/jni_android.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 gpu_process_ = new GpuProcess(io_thread_priority); | 52 gpu_process_ = new GpuProcess(io_thread_priority); |
| 52 | 53 |
| 53 gpu::GPUInfo gpu_info; | 54 gpu::GPUInfo gpu_info; |
| 54 if (!gl::init::InitializeGLOneOff()) | 55 if (!gl::init::InitializeGLOneOff()) |
| 55 VLOG(1) << "gl::init::InitializeGLOneOff failed"; | 56 VLOG(1) << "gl::init::InitializeGLOneOff failed"; |
| 56 else | 57 else |
| 57 gpu::CollectContextGraphicsInfo(&gpu_info); | 58 gpu::CollectContextGraphicsInfo(&gpu_info); |
| 58 | 59 |
| 60 gpu::GpuFeatureInfo gpu_feature_info = |
| 61 gpu::GetGpuFeatureInfo(gpu_info, *base::CommandLine::ForCurrentProcess()); |
| 62 |
| 59 // The process object takes ownership of the thread object, so do not | 63 // The process object takes ownership of the thread object, so do not |
| 60 // save and delete the pointer. | 64 // save and delete the pointer. |
| 61 GpuChildThread* child_thread = | 65 GpuChildThread* child_thread = new GpuChildThread( |
| 62 new GpuChildThread(params_, gpu_info, gpu_memory_buffer_factory_.get()); | 66 params_, gpu_info, gpu_feature_info, gpu_memory_buffer_factory_.get()); |
| 63 | 67 |
| 64 // Since we are in the browser process, use the thread start time as the | 68 // Since we are in the browser process, use the thread start time as the |
| 65 // process start time. | 69 // process start time. |
| 66 child_thread->Init(base::Time::Now()); | 70 child_thread->Init(base::Time::Now()); |
| 67 | 71 |
| 68 gpu_process_->set_main_thread(child_thread); | 72 gpu_process_->set_main_thread(child_thread); |
| 69 } | 73 } |
| 70 | 74 |
| 71 void InProcessGpuThread::CleanUp() { | 75 void InProcessGpuThread::CleanUp() { |
| 72 SetThreadWasQuitProperly(true); | 76 SetThreadWasQuitProperly(true); |
| 73 delete gpu_process_; | 77 delete gpu_process_; |
| 74 } | 78 } |
| 75 | 79 |
| 76 base::Thread* CreateInProcessGpuThread( | 80 base::Thread* CreateInProcessGpuThread( |
| 77 const InProcessChildThreadParams& params, | 81 const InProcessChildThreadParams& params, |
| 78 const gpu::GpuPreferences& gpu_preferences) { | 82 const gpu::GpuPreferences& gpu_preferences) { |
| 79 return new InProcessGpuThread(params, gpu_preferences); | 83 return new InProcessGpuThread(params, gpu_preferences); |
| 80 } | 84 } |
| 81 | 85 |
| 82 } // namespace content | 86 } // namespace content |
| OLD | NEW |