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/common/gpu/gpu_memory_buffer_factory.h" | 9 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
10 #include "content/gpu/gpu_child_thread.h" | 10 #include "content/gpu/gpu_child_thread.h" |
11 #include "content/gpu/gpu_process.h" | 11 #include "content/gpu/gpu_process.h" |
12 #include "gpu/command_buffer/service/sync_point_manager.h" | 12 #include "gpu/command_buffer/service/sync_point_manager.h" |
13 | 13 |
14 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
15 #include "base/android/jni_android.h" | 15 #include "base/android/jni_android.h" |
16 #endif | 16 #endif |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 InProcessGpuThread::InProcessGpuThread( | 20 InProcessGpuThread::InProcessGpuThread( |
21 const InProcessChildThreadParams& params, | 21 const InProcessChildThreadParams& params, |
| 22 const gpu::GpuPreferences& gpu_preferences, |
22 gpu::SyncPointManager* sync_point_manager_override) | 23 gpu::SyncPointManager* sync_point_manager_override) |
23 : base::Thread("Chrome_InProcGpuThread"), | 24 : base::Thread("Chrome_InProcGpuThread"), |
24 params_(params), | 25 params_(params), |
25 gpu_process_(NULL), | 26 gpu_process_(NULL), |
| 27 gpu_preferences_(gpu_preferences), |
26 sync_point_manager_override_(sync_point_manager_override), | 28 sync_point_manager_override_(sync_point_manager_override), |
27 gpu_memory_buffer_factory_( | 29 gpu_memory_buffer_factory_( |
28 GpuMemoryBufferFactory::GetNativeType() != gfx::EMPTY_BUFFER | 30 GpuMemoryBufferFactory::GetNativeType() != gfx::EMPTY_BUFFER |
29 ? GpuMemoryBufferFactory::CreateNativeType() | 31 ? GpuMemoryBufferFactory::CreateNativeType() |
30 : nullptr) { | 32 : nullptr) { |
31 if (!sync_point_manager_override_) { | 33 if (!sync_point_manager_override_) { |
32 sync_point_manager_.reset(new gpu::SyncPointManager(false)); | 34 sync_point_manager_.reset(new gpu::SyncPointManager(false)); |
33 sync_point_manager_override_ = sync_point_manager_.get(); | 35 sync_point_manager_override_ = sync_point_manager_.get(); |
34 } | 36 } |
35 } | 37 } |
(...skipping 13 matching lines...) Expand all Loading... |
49 base::android::AttachCurrentThreadWithName(thread_name()); | 51 base::android::AttachCurrentThreadWithName(thread_name()); |
50 // Up the priority of the |io_thread_| on Android. | 52 // Up the priority of the |io_thread_| on Android. |
51 io_thread_priority = base::ThreadPriority::DISPLAY; | 53 io_thread_priority = base::ThreadPriority::DISPLAY; |
52 #endif | 54 #endif |
53 | 55 |
54 gpu_process_ = new GpuProcess(io_thread_priority); | 56 gpu_process_ = new GpuProcess(io_thread_priority); |
55 | 57 |
56 // The process object takes ownership of the thread object, so do not | 58 // The process object takes ownership of the thread object, so do not |
57 // save and delete the pointer. | 59 // save and delete the pointer. |
58 GpuChildThread* child_thread = new GpuChildThread( | 60 GpuChildThread* child_thread = new GpuChildThread( |
59 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_); | 61 gpu_preferences_, params_, gpu_memory_buffer_factory_.get(), |
| 62 sync_point_manager_override_); |
60 | 63 |
61 // 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 |
62 // process start time. | 65 // process start time. |
63 child_thread->Init(base::Time::Now()); | 66 child_thread->Init(base::Time::Now()); |
64 | 67 |
65 gpu_process_->set_main_thread(child_thread); | 68 gpu_process_->set_main_thread(child_thread); |
66 } | 69 } |
67 | 70 |
68 void InProcessGpuThread::CleanUp() { | 71 void InProcessGpuThread::CleanUp() { |
69 SetThreadWasQuitProperly(true); | 72 SetThreadWasQuitProperly(true); |
70 delete gpu_process_; | 73 delete gpu_process_; |
71 } | 74 } |
72 | 75 |
73 base::Thread* CreateInProcessGpuThread( | 76 base::Thread* CreateInProcessGpuThread( |
74 const InProcessChildThreadParams& params) { | 77 const InProcessChildThreadParams& params) { |
75 return new InProcessGpuThread(params, nullptr); | 78 return new InProcessGpuThread( |
| 79 params, GpuChildThread::GetGpuPreferencesFromCommandLine(), nullptr); |
76 } | 80 } |
77 | 81 |
78 } // namespace content | 82 } // namespace content |
OLD | NEW |