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/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/threading/thread_local.h" | 13 #include "base/threading/thread_local.h" |
14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/child/child_process.h" | 16 #include "content/child/child_process.h" |
17 #include "content/child/thread_safe_sender.h" | 17 #include "content/child/thread_safe_sender.h" |
18 #include "content/common/establish_channel_params.h" | 18 #include "content/common/establish_channel_params.h" |
19 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" | |
20 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | |
21 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | |
22 #include "content/common/gpu/media/media_service.h" | |
23 #include "content/common/gpu_host_messages.h" | 19 #include "content/common/gpu_host_messages.h" |
24 #include "content/gpu/gpu_process_control_impl.h" | 20 #include "content/gpu/gpu_process_control_impl.h" |
25 #include "content/gpu/gpu_watchdog_thread.h" | 21 #include "content/gpu/gpu_watchdog_thread.h" |
26 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
27 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
28 #include "content/public/gpu/content_gpu_client.h" | 24 #include "content/public/gpu/content_gpu_client.h" |
29 #include "gpu/command_buffer/service/gpu_switches.h" | 25 #include "gpu/command_buffer/service/gpu_switches.h" |
30 #include "gpu/config/gpu_info_collector.h" | 26 #include "gpu/config/gpu_info_collector.h" |
31 #include "gpu/config/gpu_switches.h" | 27 #include "gpu/config/gpu_switches.h" |
32 #include "gpu/config/gpu_util.h" | 28 #include "gpu/config/gpu_util.h" |
33 #include "gpu/ipc/common/memory_stats.h" | 29 #include "gpu/ipc/common/memory_stats.h" |
34 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 30 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
35 #include "ipc/ipc_channel_handle.h" | 31 #include "ipc/ipc_channel_handle.h" |
36 #include "ipc/ipc_sync_message_filter.h" | 32 #include "ipc/ipc_sync_message_filter.h" |
| 33 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" |
| 34 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" |
| 35 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" |
| 36 #include "media/gpu/ipc/service/media_service.h" |
37 #include "ui/gl/gl_implementation.h" | 37 #include "ui/gl/gl_implementation.h" |
38 #include "ui/gl/gl_switches.h" | 38 #include "ui/gl/gl_switches.h" |
39 #include "ui/gl/gpu_switching_manager.h" | 39 #include "ui/gl/gpu_switching_manager.h" |
40 #include "url/gurl.h" | 40 #include "url/gurl.h" |
41 | 41 |
42 #if defined(USE_OZONE) | 42 #if defined(USE_OZONE) |
43 #include "ui/ozone/public/gpu_platform_support.h" | 43 #include "ui/ozone/public/gpu_platform_support.h" |
44 #include "ui/ozone/public/ozone_platform.h" | 44 #include "ui/ozone/public/ozone_platform.h" |
45 #endif | 45 #endif |
46 | 46 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 void GpuChildThread::StoreShaderToDisk(int32_t client_id, | 370 void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
371 const std::string& key, | 371 const std::string& key, |
372 const std::string& shader) { | 372 const std::string& shader) { |
373 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); | 373 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); |
374 } | 374 } |
375 | 375 |
376 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { | 376 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { |
377 gpu_preferences_ = gpu_preferences; | 377 gpu_preferences_ = gpu_preferences; |
378 | 378 |
379 gpu_info_.video_decode_accelerator_capabilities = | 379 gpu_info_.video_decode_accelerator_capabilities = |
380 content::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); | 380 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); |
381 gpu_info_.video_encode_accelerator_supported_profiles = | 381 gpu_info_.video_encode_accelerator_supported_profiles = |
382 content::GpuVideoEncodeAccelerator::GetSupportedProfiles( | 382 media::GpuVideoEncodeAccelerator::GetSupportedProfiles( |
383 gpu_preferences_); | 383 gpu_preferences_); |
384 gpu_info_.jpeg_decode_accelerator_supported = | 384 gpu_info_.jpeg_decode_accelerator_supported = |
385 content::GpuJpegDecodeAccelerator::IsSupported(); | 385 media::GpuJpegDecodeAccelerator::IsSupported(); |
386 | 386 |
387 // Record initialization only after collecting the GPU info because that can | 387 // Record initialization only after collecting the GPU info because that can |
388 // take a significant amount of time. | 388 // take a significant amount of time. |
389 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 389 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
390 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 390 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
391 while (!deferred_messages_.empty()) { | 391 while (!deferred_messages_.empty()) { |
392 Send(deferred_messages_.front()); | 392 Send(deferred_messages_.front()); |
393 deferred_messages_.pop(); | 393 deferred_messages_.pop(); |
394 } | 394 } |
395 | 395 |
(...skipping 11 matching lines...) Expand all Loading... |
407 // Defer creation of the render thread. This is to prevent it from handling | 407 // Defer creation of the render thread. This is to prevent it from handling |
408 // IPC messages before the sandbox has been enabled and all other necessary | 408 // IPC messages before the sandbox has been enabled and all other necessary |
409 // initialization has succeeded. | 409 // initialization has succeeded. |
410 gpu_channel_manager_.reset( | 410 gpu_channel_manager_.reset( |
411 new gpu::GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), | 411 new gpu::GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), |
412 base::ThreadTaskRunnerHandle::Get().get(), | 412 base::ThreadTaskRunnerHandle::Get().get(), |
413 ChildProcess::current()->io_task_runner(), | 413 ChildProcess::current()->io_task_runner(), |
414 ChildProcess::current()->GetShutDownEvent(), | 414 ChildProcess::current()->GetShutDownEvent(), |
415 sync_point_manager_, gpu_memory_buffer_factory_)); | 415 sync_point_manager_, gpu_memory_buffer_factory_)); |
416 | 416 |
417 media_service_.reset(new MediaService(gpu_channel_manager_.get())); | 417 media_service_.reset(new media::MediaService(gpu_channel_manager_.get())); |
418 | 418 |
419 #if defined(USE_OZONE) | 419 #if defined(USE_OZONE) |
420 ui::OzonePlatform::GetInstance() | 420 ui::OzonePlatform::GetInstance() |
421 ->GetGpuPlatformSupport() | 421 ->GetGpuPlatformSupport() |
422 ->OnChannelEstablished(this); | 422 ->OnChannelEstablished(this); |
423 #endif | 423 #endif |
424 } | 424 } |
425 | 425 |
426 void GpuChildThread::OnFinalize() { | 426 void GpuChildThread::OnFinalize() { |
427 // Quit the GPU process | 427 // Quit the GPU process |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 void GpuChildThread::BindProcessControlRequest( | 589 void GpuChildThread::BindProcessControlRequest( |
590 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 590 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
591 DVLOG(1) << "GPU: Binding ProcessControl request"; | 591 DVLOG(1) << "GPU: Binding ProcessControl request"; |
592 DCHECK(process_control_); | 592 DCHECK(process_control_); |
593 process_control_bindings_.AddBinding(process_control_.get(), | 593 process_control_bindings_.AddBinding(process_control_.get(), |
594 std::move(request)); | 594 std::move(request)); |
595 } | 595 } |
596 | 596 |
597 } // namespace content | 597 } // namespace content |
OLD | NEW |