Chromium Code Reviews| 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/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/child/child_process.h" | 15 #include "content/child/child_process.h" |
| 16 #include "content/child/thread_safe_sender.h" | 16 #include "content/child/thread_safe_sender.h" |
| 17 #include "content/common/gpu/establish_channel_params.h" | 17 #include "content/common/gpu/establish_channel_params.h" |
| 18 #include "content/common/gpu/gpu_host_messages.h" | 18 #include "content/common/gpu/gpu_host_messages.h" |
| 19 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 19 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 20 #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_decode_accelerator.h" |
| 22 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | |
| 21 #include "content/common/gpu/media/media_service.h" | 23 #include "content/common/gpu/media/media_service.h" |
| 22 #include "content/gpu/gpu_process_control_impl.h" | 24 #include "content/gpu/gpu_process_control_impl.h" |
| 23 #include "content/gpu/gpu_watchdog_thread.h" | 25 #include "content/gpu/gpu_watchdog_thread.h" |
| 24 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 25 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/gpu/content_gpu_client.h" | 28 #include "content/public/gpu/content_gpu_client.h" |
| 27 #include "gpu/command_buffer/service/gpu_switches.h" | 29 #include "gpu/command_buffer/service/gpu_switches.h" |
| 28 #include "gpu/config/gpu_info_collector.h" | 30 #include "gpu/config/gpu_info_collector.h" |
| 29 #include "gpu/config/gpu_switches.h" | 31 #include "gpu/config/gpu_switches.h" |
| 30 #include "gpu/config/gpu_util.h" | 32 #include "gpu/config/gpu_util.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 in_browser_process_(true), | 184 in_browser_process_(true), |
| 183 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 185 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 184 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
| 185 target_services_ = NULL; | 187 target_services_ = NULL; |
| 186 #endif | 188 #endif |
| 187 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 189 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 188 switches::kSingleProcess) || | 190 switches::kSingleProcess) || |
| 189 base::CommandLine::ForCurrentProcess()->HasSwitch( | 191 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 190 switches::kInProcessGPU)); | 192 switches::kInProcessGPU)); |
| 191 | 193 |
| 192 // Populate accelerator capabilities (normally done during GpuMain, which is | 194 // Populate accelerator capabilities (normally done during |
| 193 // not called for single process or in process gpu). | 195 // GpuChildThread::OnInitialize, which is not called for single process or in |
| 196 // process gpu). | |
|
piman
2016/03/11 20:43:56
Actually, GpuChildThread::OnInitialize is called,
Peng
2016/03/11 22:43:16
Done.
| |
| 194 gpu_info_.video_decode_accelerator_capabilities = | 197 gpu_info_.video_decode_accelerator_capabilities = |
| 195 content::GpuVideoDecodeAccelerator::GetCapabilities(); | 198 content::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); |
| 196 | 199 |
| 197 #if defined(ENABLE_VULKAN) | 200 #if defined(ENABLE_VULKAN) |
| 198 // Temporary Vulkan initialization injection. | 201 // Temporary Vulkan initialization injection. |
| 199 gpu::VulkanSurface::InitializeOneOff(); | 202 gpu::VulkanSurface::InitializeOneOff(); |
| 200 #endif | 203 #endif |
| 201 | 204 |
| 202 if (!gfx::GLSurface::InitializeOneOff()) | 205 if (!gfx::GLSurface::InitializeOneOff()) |
| 203 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 206 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
| 204 | 207 |
| 205 g_thread_safe_sender.Get() = thread_safe_sender(); | 208 g_thread_safe_sender.Get() = thread_safe_sender(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 #endif | 345 #endif |
| 343 | 346 |
| 344 void GpuChildThread::StoreShaderToDisk(int32_t client_id, | 347 void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
| 345 const std::string& key, | 348 const std::string& key, |
| 346 const std::string& shader) { | 349 const std::string& shader) { |
| 347 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); | 350 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); |
| 348 } | 351 } |
| 349 | 352 |
| 350 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { | 353 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { |
| 351 gpu_preferences_ = gpu_preferences; | 354 gpu_preferences_ = gpu_preferences; |
| 355 | |
| 356 gpu_info_.video_decode_accelerator_capabilities = | |
| 357 content::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); | |
| 358 gpu_info_.video_encode_accelerator_supported_profiles = | |
| 359 content::GpuVideoEncodeAccelerator::GetSupportedProfiles( | |
| 360 gpu_preferences_); | |
| 361 gpu_info_.jpeg_decode_accelerator_supported = | |
| 362 content::GpuJpegDecodeAccelerator::IsSupported(); | |
| 363 | |
| 352 // Record initialization only after collecting the GPU info because that can | 364 // Record initialization only after collecting the GPU info because that can |
| 353 // take a significant amount of time. | 365 // take a significant amount of time. |
| 354 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 366 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 355 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 367 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
| 356 while (!deferred_messages_.empty()) { | 368 while (!deferred_messages_.empty()) { |
| 357 Send(deferred_messages_.front()); | 369 Send(deferred_messages_.front()); |
| 358 deferred_messages_.pop(); | 370 deferred_messages_.pop(); |
| 359 } | 371 } |
| 360 | 372 |
| 361 if (dead_on_arrival_) { | 373 if (dead_on_arrival_) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 | 562 |
| 551 void GpuChildThread::BindProcessControlRequest( | 563 void GpuChildThread::BindProcessControlRequest( |
| 552 mojo::InterfaceRequest<ProcessControl> request) { | 564 mojo::InterfaceRequest<ProcessControl> request) { |
| 553 DVLOG(1) << "GPU: Binding ProcessControl request"; | 565 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 554 DCHECK(process_control_); | 566 DCHECK(process_control_); |
| 555 process_control_bindings_.AddBinding(process_control_.get(), | 567 process_control_bindings_.AddBinding(process_control_.get(), |
| 556 std::move(request)); | 568 std::move(request)); |
| 557 } | 569 } |
| 558 | 570 |
| 559 } // namespace content | 571 } // namespace content |
| OLD | NEW |