| 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" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/threading/thread_local.h" | 14 #include "base/threading/thread_local.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "base/threading/worker_pool.h" | 16 #include "base/threading/worker_pool.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/child/child_process.h" | 18 #include "content/child/child_process.h" |
| 19 #include "content/child/thread_safe_sender.h" | 19 #include "content/child/thread_safe_sender.h" |
| 20 #include "content/common/establish_channel_params.h" | 20 #include "content/common/establish_channel_params.h" |
| 21 #include "content/common/gpu_host_messages.h" | 21 #include "content/common/gpu_host_messages.h" |
| 22 #include "content/gpu/gpu_service_factory.h" | 22 #include "content/gpu/gpu_service_factory.h" |
| 23 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
| 24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 25 #include "content/public/common/service_manager_connection.h" | 25 #include "content/public/common/service_manager_connection.h" |
| 26 #include "content/public/gpu/content_gpu_client.h" | 26 #include "content/public/gpu/content_gpu_client.h" |
| 27 #include "gpu/command_buffer/common/activity_flags.h" |
| 27 #include "gpu/command_buffer/service/gpu_switches.h" | 28 #include "gpu/command_buffer/service/gpu_switches.h" |
| 28 #include "gpu/command_buffer/service/sync_point_manager.h" | 29 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 29 #include "gpu/config/gpu_info_collector.h" | 30 #include "gpu/config/gpu_info_collector.h" |
| 30 #include "gpu/config/gpu_switches.h" | 31 #include "gpu/config/gpu_switches.h" |
| 31 #include "gpu/config/gpu_util.h" | 32 #include "gpu/config/gpu_util.h" |
| 32 #include "gpu/ipc/common/memory_stats.h" | 33 #include "gpu/ipc/common/memory_stats.h" |
| 33 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 34 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 34 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 35 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 35 #include "ipc/ipc_channel_handle.h" | 36 #include "ipc/ipc_channel_handle.h" |
| 36 #include "ipc/ipc_sync_message_filter.h" | 37 #include "ipc/ipc_sync_message_filter.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 mojo::ScopedInterfaceEndpointHandle handle) { | 276 mojo::ScopedInterfaceEndpointHandle handle) { |
| 276 if (associated_interfaces_.CanBindRequest(name)) | 277 if (associated_interfaces_.CanBindRequest(name)) |
| 277 associated_interfaces_.BindRequest(name, std::move(handle)); | 278 associated_interfaces_.BindRequest(name, std::move(handle)); |
| 278 else | 279 else |
| 279 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); | 280 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); |
| 280 } | 281 } |
| 281 | 282 |
| 282 void GpuChildThread::CreateGpuService( | 283 void GpuChildThread::CreateGpuService( |
| 283 ui::mojom::GpuServiceRequest request, | 284 ui::mojom::GpuServiceRequest request, |
| 284 ui::mojom::GpuHostPtr gpu_host, | 285 ui::mojom::GpuHostPtr gpu_host, |
| 285 const gpu::GpuPreferences& gpu_preferences) { | 286 const gpu::GpuPreferences& gpu_preferences, |
| 287 mojo::ScopedSharedBufferHandle activity_flags) { |
| 286 gpu_service_->Bind(std::move(request)); | 288 gpu_service_->Bind(std::move(request)); |
| 287 | 289 |
| 288 gpu_info_.video_decode_accelerator_capabilities = | 290 gpu_info_.video_decode_accelerator_capabilities = |
| 289 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); | 291 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences); |
| 290 gpu_info_.video_encode_accelerator_supported_profiles = | 292 gpu_info_.video_encode_accelerator_supported_profiles = |
| 291 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); | 293 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences); |
| 292 gpu_info_.jpeg_decode_accelerator_supported = | 294 gpu_info_.jpeg_decode_accelerator_supported = |
| 293 media::GpuJpegDecodeAcceleratorFactoryProvider:: | 295 media::GpuJpegDecodeAcceleratorFactoryProvider:: |
| 294 IsAcceleratedJpegDecodeSupported(); | 296 IsAcceleratedJpegDecodeSupported(); |
| 295 | 297 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 312 | 314 |
| 313 // We don't need to pipe log messages if we are running the GPU thread in | 315 // We don't need to pipe log messages if we are running the GPU thread in |
| 314 // the browser process. | 316 // the browser process. |
| 315 if (!in_browser_process_) | 317 if (!in_browser_process_) |
| 316 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 318 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
| 317 | 319 |
| 318 gpu::SyncPointManager* sync_point_manager = nullptr; | 320 gpu::SyncPointManager* sync_point_manager = nullptr; |
| 319 // Note SyncPointManager from ContentGpuClient cannot be owned by this. | 321 // Note SyncPointManager from ContentGpuClient cannot be owned by this. |
| 320 if (GetContentClient()->gpu()) | 322 if (GetContentClient()->gpu()) |
| 321 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); | 323 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); |
| 322 gpu_service_->InitializeWithHost(std::move(gpu_host), gpu_preferences, | 324 gpu_service_->InitializeWithHost( |
| 323 sync_point_manager, | 325 std::move(gpu_host), gpu_preferences, |
| 324 ChildProcess::current()->GetShutDownEvent()); | 326 gpu::GpuProcessActivityFlags(std::move(activity_flags)), |
| 327 sync_point_manager, ChildProcess::current()->GetShutDownEvent()); |
| 325 CHECK(gpu_service_->media_gpu_channel_manager()); | 328 CHECK(gpu_service_->media_gpu_channel_manager()); |
| 326 | 329 |
| 327 // Only set once per process instance. | 330 // Only set once per process instance. |
| 328 service_factory_.reset(new GpuServiceFactory( | 331 service_factory_.reset(new GpuServiceFactory( |
| 329 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); | 332 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); |
| 330 | 333 |
| 331 GetInterfaceRegistry()->AddInterface(base::Bind( | 334 GetInterfaceRegistry()->AddInterface(base::Bind( |
| 332 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); | 335 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); |
| 333 | 336 |
| 334 if (GetContentClient()->gpu()) { // NULL in tests. | 337 if (GetContentClient()->gpu()) { // NULL in tests. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 426 |
| 424 void GpuChildThread::BindServiceFactoryRequest( | 427 void GpuChildThread::BindServiceFactoryRequest( |
| 425 service_manager::mojom::ServiceFactoryRequest request) { | 428 service_manager::mojom::ServiceFactoryRequest request) { |
| 426 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 429 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
| 427 DCHECK(service_factory_); | 430 DCHECK(service_factory_); |
| 428 service_factory_bindings_.AddBinding(service_factory_.get(), | 431 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 429 std::move(request)); | 432 std::move(request)); |
| 430 } | 433 } |
| 431 | 434 |
| 432 } // namespace content | 435 } // namespace content |
| OLD | NEW |