| 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/ipc/common/gpu_memory_buffer_support.h" | 12 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 13 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 14 #include "ui/gl/init/gl_factory.h" |
| 13 | 15 |
| 14 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
| 15 #include "base/android/jni_android.h" | 17 #include "base/android/jni_android.h" |
| 16 #endif | 18 #endif |
| 17 | 19 |
| 18 namespace content { | 20 namespace content { |
| 19 | 21 |
| 20 InProcessGpuThread::InProcessGpuThread( | 22 InProcessGpuThread::InProcessGpuThread( |
| 21 const InProcessChildThreadParams& params, | 23 const InProcessChildThreadParams& params, |
| 22 const gpu::GpuPreferences& gpu_preferences) | 24 const gpu::GpuPreferences& gpu_preferences) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 // calls. The latter causes Java VM to assign Thread-??? to the thread name. | 43 // calls. The latter causes Java VM to assign Thread-??? to the thread name. |
| 42 // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread | 44 // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread |
| 43 // will not change the thread name kept in Java VM. | 45 // will not change the thread name kept in Java VM. |
| 44 base::android::AttachCurrentThreadWithName(thread_name()); | 46 base::android::AttachCurrentThreadWithName(thread_name()); |
| 45 // Up the priority of the |io_thread_| on Android. | 47 // Up the priority of the |io_thread_| on Android. |
| 46 io_thread_priority = base::ThreadPriority::DISPLAY; | 48 io_thread_priority = base::ThreadPriority::DISPLAY; |
| 47 #endif | 49 #endif |
| 48 | 50 |
| 49 gpu_process_ = new GpuProcess(io_thread_priority); | 51 gpu_process_ = new GpuProcess(io_thread_priority); |
| 50 | 52 |
| 53 gpu::GPUInfo gpu_info; |
| 54 if (!gl::init::InitializeGLOneOff()) |
| 55 VLOG(1) << "gl::init::InitializeGLOneOff failed"; |
| 56 else |
| 57 gpu::CollectContextGraphicsInfo(&gpu_info); |
| 58 |
| 51 // The process object takes ownership of the thread object, so do not | 59 // The process object takes ownership of the thread object, so do not |
| 52 // save and delete the pointer. | 60 // save and delete the pointer. |
| 53 GpuChildThread* child_thread = | 61 GpuChildThread* child_thread = |
| 54 new GpuChildThread(params_, gpu_memory_buffer_factory_.get()); | 62 new GpuChildThread(params_, gpu_info, gpu_memory_buffer_factory_.get()); |
| 55 | 63 |
| 56 // Since we are in the browser process, use the thread start time as the | 64 // Since we are in the browser process, use the thread start time as the |
| 57 // process start time. | 65 // process start time. |
| 58 child_thread->Init(base::Time::Now()); | 66 child_thread->Init(base::Time::Now()); |
| 59 | 67 |
| 60 gpu_process_->set_main_thread(child_thread); | 68 gpu_process_->set_main_thread(child_thread); |
| 61 } | 69 } |
| 62 | 70 |
| 63 void InProcessGpuThread::CleanUp() { | 71 void InProcessGpuThread::CleanUp() { |
| 64 SetThreadWasQuitProperly(true); | 72 SetThreadWasQuitProperly(true); |
| 65 delete gpu_process_; | 73 delete gpu_process_; |
| 66 } | 74 } |
| 67 | 75 |
| 68 base::Thread* CreateInProcessGpuThread( | 76 base::Thread* CreateInProcessGpuThread( |
| 69 const InProcessChildThreadParams& params, | 77 const InProcessChildThreadParams& params, |
| 70 const gpu::GpuPreferences& gpu_preferences) { | 78 const gpu::GpuPreferences& gpu_preferences) { |
| 71 return new InProcessGpuThread(params, gpu_preferences); | 79 return new InProcessGpuThread(params, gpu_preferences); |
| 72 } | 80 } |
| 73 | 81 |
| 74 } // namespace content | 82 } // namespace content |
| OLD | NEW |