| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 return builder.Build(); | 141 return builder.Build(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace | 144 } // namespace |
| 145 | 145 |
| 146 GpuChildThread::GpuChildThread( | 146 GpuChildThread::GpuChildThread( |
| 147 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, | 147 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, |
| 148 bool dead_on_arrival, | 148 bool dead_on_arrival, |
| 149 const gpu::GPUInfo& gpu_info, | 149 const gpu::GPUInfo& gpu_info, |
| 150 const gpu::GpuFeatureInfo& gpu_feature_info, |
| 150 const DeferredMessages& deferred_messages, | 151 const DeferredMessages& deferred_messages, |
| 151 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 152 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 152 : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)), | 153 : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)), |
| 153 dead_on_arrival_(dead_on_arrival), | 154 dead_on_arrival_(dead_on_arrival), |
| 154 gpu_info_(gpu_info), | 155 gpu_info_(gpu_info), |
| 155 deferred_messages_(deferred_messages), | 156 deferred_messages_(deferred_messages), |
| 156 in_browser_process_(false), | 157 in_browser_process_(false), |
| 157 gpu_service_( | 158 gpu_service_(new ui::GpuService(gpu_info, |
| 158 new ui::GpuService(gpu_info, | 159 std::move(watchdog_thread), |
| 159 std::move(watchdog_thread), | 160 gpu_memory_buffer_factory, |
| 160 gpu_memory_buffer_factory, | 161 ChildProcess::current()->io_task_runner(), |
| 161 ChildProcess::current()->io_task_runner())), | 162 gpu_feature_info)), |
| 162 gpu_main_binding_(this) { | 163 gpu_main_binding_(this) { |
| 163 #if defined(OS_WIN) | 164 #if defined(OS_WIN) |
| 164 target_services_ = NULL; | 165 target_services_ = NULL; |
| 165 #endif | 166 #endif |
| 166 g_thread_safe_sender.Get() = thread_safe_sender(); | 167 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 167 } | 168 } |
| 168 | 169 |
| 169 GpuChildThread::GpuChildThread( | 170 GpuChildThread::GpuChildThread( |
| 170 const InProcessChildThreadParams& params, | 171 const InProcessChildThreadParams& params, |
| 171 const gpu::GPUInfo& gpu_info, | 172 const gpu::GPUInfo& gpu_info, |
| 173 const gpu::GpuFeatureInfo& gpu_feature_info, |
| 172 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 174 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 173 : ChildThreadImpl(ChildThreadImpl::Options::Builder() | 175 : ChildThreadImpl(ChildThreadImpl::Options::Builder() |
| 174 .InBrowserProcess(params) | 176 .InBrowserProcess(params) |
| 175 .AddStartupFilter(new GpuMemoryBufferMessageFilter( | 177 .AddStartupFilter(new GpuMemoryBufferMessageFilter( |
| 176 gpu_memory_buffer_factory)) | 178 gpu_memory_buffer_factory)) |
| 177 .ConnectToBrowser(true) | 179 .ConnectToBrowser(true) |
| 178 .Build()), | 180 .Build()), |
| 179 dead_on_arrival_(false), | 181 dead_on_arrival_(false), |
| 180 gpu_info_(gpu_info), | 182 gpu_info_(gpu_info), |
| 181 in_browser_process_(true), | 183 in_browser_process_(true), |
| 182 gpu_service_( | 184 gpu_service_(new ui::GpuService(gpu_info, |
| 183 new ui::GpuService(gpu_info, | 185 nullptr /* watchdog thread */, |
| 184 nullptr /* watchdog thread */, | 186 gpu_memory_buffer_factory, |
| 185 gpu_memory_buffer_factory, | 187 ChildProcess::current()->io_task_runner(), |
| 186 ChildProcess::current()->io_task_runner())), | 188 gpu_feature_info)), |
| 187 gpu_main_binding_(this) { | 189 gpu_main_binding_(this) { |
| 188 #if defined(OS_WIN) | 190 #if defined(OS_WIN) |
| 189 target_services_ = NULL; | 191 target_services_ = NULL; |
| 190 #endif | 192 #endif |
| 191 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 193 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 192 switches::kSingleProcess) || | 194 switches::kSingleProcess) || |
| 193 base::CommandLine::ForCurrentProcess()->HasSwitch( | 195 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 194 switches::kInProcessGPU)); | 196 switches::kInProcessGPU)); |
| 195 | 197 |
| 196 g_thread_safe_sender.Get() = thread_safe_sender(); | 198 g_thread_safe_sender.Get() = thread_safe_sender(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 gpu_info_.video_decode_accelerator_capabilities = | 302 gpu_info_.video_decode_accelerator_capabilities = |
| 301 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); | 303 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); |
| 302 gpu_info_.video_encode_accelerator_supported_profiles = | 304 gpu_info_.video_encode_accelerator_supported_profiles = |
| 303 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); | 305 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); |
| 304 gpu_info_.jpeg_decode_accelerator_supported = | 306 gpu_info_.jpeg_decode_accelerator_supported = |
| 305 media::GpuJpegDecodeAccelerator::IsSupported(); | 307 media::GpuJpegDecodeAccelerator::IsSupported(); |
| 306 | 308 |
| 307 // Record initialization only after collecting the GPU info because that can | 309 // Record initialization only after collecting the GPU info because that can |
| 308 // take a significant amount of time. | 310 // take a significant amount of time. |
| 309 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 311 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 310 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 312 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_, |
| 313 gpu_service_->gpu_feature_info())); |
| 311 while (!deferred_messages_.empty()) { | 314 while (!deferred_messages_.empty()) { |
| 312 const LogMessage& log = deferred_messages_.front(); | 315 const LogMessage& log = deferred_messages_.front(); |
| 313 Send(new GpuHostMsg_OnLogMessage(log.severity, log.header, log.message)); | 316 Send(new GpuHostMsg_OnLogMessage(log.severity, log.header, log.message)); |
| 314 deferred_messages_.pop(); | 317 deferred_messages_.pop(); |
| 315 } | 318 } |
| 316 | 319 |
| 317 if (dead_on_arrival_) { | 320 if (dead_on_arrival_) { |
| 318 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; | 321 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; |
| 319 base::MessageLoop::current()->QuitWhenIdle(); | 322 base::MessageLoop::current()->QuitWhenIdle(); |
| 320 return; | 323 return; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 499 |
| 497 void GpuChildThread::BindServiceFactoryRequest( | 500 void GpuChildThread::BindServiceFactoryRequest( |
| 498 service_manager::mojom::ServiceFactoryRequest request) { | 501 service_manager::mojom::ServiceFactoryRequest request) { |
| 499 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 502 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
| 500 DCHECK(service_factory_); | 503 DCHECK(service_factory_); |
| 501 service_factory_bindings_.AddBinding(service_factory_.get(), | 504 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 502 std::move(request)); | 505 std::move(request)); |
| 503 } | 506 } |
| 504 | 507 |
| 505 } // namespace content | 508 } // namespace content |
| OLD | NEW |