| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 return builder.Build(); | 140 return builder.Build(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| 145 GpuChildThread::GpuChildThread( | 145 GpuChildThread::GpuChildThread( |
| 146 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, | 146 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, |
| 147 bool dead_on_arrival, | 147 bool dead_on_arrival, |
| 148 const gpu::GPUInfo& gpu_info, | 148 const gpu::GPUInfo& gpu_info, |
| 149 const gpu::GPUFeatureStatus& gpu_feature_status, |
| 149 const DeferredMessages& deferred_messages, | 150 const DeferredMessages& deferred_messages, |
| 150 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 151 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 151 : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)), | 152 : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)), |
| 152 dead_on_arrival_(dead_on_arrival), | 153 dead_on_arrival_(dead_on_arrival), |
| 153 watchdog_thread_(std::move(watchdog_thread)), | 154 watchdog_thread_(std::move(watchdog_thread)), |
| 154 gpu_info_(gpu_info), | 155 gpu_info_(gpu_info), |
| 156 gpu_feature_status_(std::move(gpu_feature_status)), |
| 155 deferred_messages_(deferred_messages), | 157 deferred_messages_(deferred_messages), |
| 156 in_browser_process_(false), | 158 in_browser_process_(false), |
| 157 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 159 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 158 #if defined(OS_WIN) | 160 #if defined(OS_WIN) |
| 159 target_services_ = NULL; | 161 target_services_ = NULL; |
| 160 #endif | 162 #endif |
| 161 g_thread_safe_sender.Get() = thread_safe_sender(); | 163 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 162 } | 164 } |
| 163 | 165 |
| 164 GpuChildThread::GpuChildThread( | 166 GpuChildThread::GpuChildThread( |
| 165 const InProcessChildThreadParams& params, | 167 const InProcessChildThreadParams& params, |
| 166 const gpu::GPUInfo& gpu_info, | 168 const gpu::GPUInfo& gpu_info, |
| 169 const gpu::GPUFeatureStatus& gpu_feature_status, |
| 167 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 170 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 168 : ChildThreadImpl(ChildThreadImpl::Options::Builder() | 171 : ChildThreadImpl(ChildThreadImpl::Options::Builder() |
| 169 .InBrowserProcess(params) | 172 .InBrowserProcess(params) |
| 170 .AddStartupFilter(new GpuMemoryBufferMessageFilter( | 173 .AddStartupFilter(new GpuMemoryBufferMessageFilter( |
| 171 gpu_memory_buffer_factory)) | 174 gpu_memory_buffer_factory)) |
| 172 .ConnectToBrowser(true) | 175 .ConnectToBrowser(true) |
| 173 .Build()), | 176 .Build()), |
| 174 dead_on_arrival_(false), | 177 dead_on_arrival_(false), |
| 175 gpu_info_(gpu_info), | 178 gpu_info_(gpu_info), |
| 179 gpu_feature_status_(std::move(gpu_feature_status)), |
| 176 in_browser_process_(true), | 180 in_browser_process_(true), |
| 177 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 181 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 178 #if defined(OS_WIN) | 182 #if defined(OS_WIN) |
| 179 target_services_ = NULL; | 183 target_services_ = NULL; |
| 180 #endif | 184 #endif |
| 181 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 185 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 182 switches::kSingleProcess) || | 186 switches::kSingleProcess) || |
| 183 base::CommandLine::ForCurrentProcess()->HasSwitch( | 187 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 184 switches::kInProcessGPU)); | 188 switches::kInProcessGPU)); |
| 185 | 189 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 gpu_info_.video_decode_accelerator_capabilities = | 318 gpu_info_.video_decode_accelerator_capabilities = |
| 315 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); | 319 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); |
| 316 gpu_info_.video_encode_accelerator_supported_profiles = | 320 gpu_info_.video_encode_accelerator_supported_profiles = |
| 317 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); | 321 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); |
| 318 gpu_info_.jpeg_decode_accelerator_supported = | 322 gpu_info_.jpeg_decode_accelerator_supported = |
| 319 media::GpuJpegDecodeAccelerator::IsSupported(); | 323 media::GpuJpegDecodeAccelerator::IsSupported(); |
| 320 | 324 |
| 321 // Record initialization only after collecting the GPU info because that can | 325 // Record initialization only after collecting the GPU info because that can |
| 322 // take a significant amount of time. | 326 // take a significant amount of time. |
| 323 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 327 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 324 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 328 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_, |
| 329 gpu_feature_status_)); |
| 325 while (!deferred_messages_.empty()) { | 330 while (!deferred_messages_.empty()) { |
| 326 const LogMessage& log = deferred_messages_.front(); | 331 const LogMessage& log = deferred_messages_.front(); |
| 327 Send(new GpuHostMsg_OnLogMessage(log.severity, log.header, log.message)); | 332 Send(new GpuHostMsg_OnLogMessage(log.severity, log.header, log.message)); |
| 328 deferred_messages_.pop(); | 333 deferred_messages_.pop(); |
| 329 } | 334 } |
| 330 | 335 |
| 331 if (dead_on_arrival_) { | 336 if (dead_on_arrival_) { |
| 332 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; | 337 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; |
| 333 base::MessageLoop::current()->QuitWhenIdle(); | 338 base::MessageLoop::current()->QuitWhenIdle(); |
| 334 return; | 339 return; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 534 |
| 530 void GpuChildThread::BindServiceFactoryRequest( | 535 void GpuChildThread::BindServiceFactoryRequest( |
| 531 service_manager::mojom::ServiceFactoryRequest request) { | 536 service_manager::mojom::ServiceFactoryRequest request) { |
| 532 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 537 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
| 533 DCHECK(service_factory_); | 538 DCHECK(service_factory_); |
| 534 service_factory_bindings_.AddBinding(service_factory_.get(), | 539 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 535 std::move(request)); | 540 std::move(request)); |
| 536 } | 541 } |
| 537 | 542 |
| 538 } // namespace content | 543 } // namespace content |
| OLD | NEW |