| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 else | 294 else |
| 295 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); | 295 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void GpuChildThread::CreateGpuService( | 298 void GpuChildThread::CreateGpuService( |
| 299 ui::mojom::GpuServiceRequest request, | 299 ui::mojom::GpuServiceRequest request, |
| 300 ui::mojom::GpuHostPtr gpu_host, | 300 ui::mojom::GpuHostPtr gpu_host, |
| 301 const gpu::GpuPreferences& gpu_preferences) { | 301 const gpu::GpuPreferences& gpu_preferences) { |
| 302 gpu_service_->Bind(std::move(request)); | 302 gpu_service_->Bind(std::move(request)); |
| 303 | 303 |
| 304 gpu::GpuDriverBugWorkarounds workarounds( |
| 305 base::CommandLine::ForCurrentProcess()); |
| 306 |
| 304 gpu_info_.video_decode_accelerator_capabilities = | 307 gpu_info_.video_decode_accelerator_capabilities = |
| 305 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); | 308 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences, |
| 309 workarounds); |
| 306 gpu_info_.video_encode_accelerator_supported_profiles = | 310 gpu_info_.video_encode_accelerator_supported_profiles = |
| 307 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); | 311 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); |
| 308 gpu_info_.jpeg_decode_accelerator_supported = | 312 gpu_info_.jpeg_decode_accelerator_supported = |
| 309 media::GpuJpegDecodeAccelerator::IsSupported(); | 313 media::GpuJpegDecodeAccelerator::IsSupported(); |
| 310 | 314 |
| 311 // Record initialization only after collecting the GPU info because that can | 315 // Record initialization only after collecting the GPU info because that can |
| 312 // take a significant amount of time. | 316 // take a significant amount of time. |
| 313 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 317 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 314 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 318 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
| 315 while (!deferred_messages_.empty()) { | 319 while (!deferred_messages_.empty()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 327 // We don't need to pipe log messages if we are running the GPU thread in | 331 // We don't need to pipe log messages if we are running the GPU thread in |
| 328 // the browser process. | 332 // the browser process. |
| 329 if (!in_browser_process_) | 333 if (!in_browser_process_) |
| 330 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 334 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
| 331 | 335 |
| 332 gpu::SyncPointManager* sync_point_manager = nullptr; | 336 gpu::SyncPointManager* sync_point_manager = nullptr; |
| 333 // Note SyncPointManager from ContentGpuClient cannot be owned by this. | 337 // Note SyncPointManager from ContentGpuClient cannot be owned by this. |
| 334 if (GetContentClient()->gpu()) | 338 if (GetContentClient()->gpu()) |
| 335 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); | 339 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); |
| 336 gpu_service_->InitializeWithHost(std::move(gpu_host), gpu_preferences, | 340 gpu_service_->InitializeWithHost(std::move(gpu_host), gpu_preferences, |
| 337 sync_point_manager, | 341 workarounds, sync_point_manager, |
| 338 ChildProcess::current()->GetShutDownEvent()); | 342 ChildProcess::current()->GetShutDownEvent()); |
| 339 CHECK(gpu_service_->media_gpu_channel_manager()); | 343 CHECK(gpu_service_->media_gpu_channel_manager()); |
| 340 | 344 |
| 341 // Only set once per process instance. | 345 // Only set once per process instance. |
| 342 service_factory_.reset(new GpuServiceFactory( | 346 service_factory_.reset(new GpuServiceFactory( |
| 343 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); | 347 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); |
| 344 | 348 |
| 345 GetInterfaceRegistry()->AddInterface(base::Bind( | 349 GetInterfaceRegistry()->AddInterface(base::Bind( |
| 346 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); | 350 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); |
| 347 | 351 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 510 |
| 507 void GpuChildThread::BindServiceFactoryRequest( | 511 void GpuChildThread::BindServiceFactoryRequest( |
| 508 service_manager::mojom::ServiceFactoryRequest request) { | 512 service_manager::mojom::ServiceFactoryRequest request) { |
| 509 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 513 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
| 510 DCHECK(service_factory_); | 514 DCHECK(service_factory_); |
| 511 service_factory_bindings_.AddBinding(service_factory_.get(), | 515 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 512 std::move(request)); | 516 std::move(request)); |
| 513 } | 517 } |
| 514 | 518 |
| 515 } // namespace content | 519 } // namespace content |
| OLD | NEW |