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/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/child/child_process.h" | 14 #include "content/child/child_process.h" |
15 #include "content/child/thread_safe_sender.h" | 15 #include "content/child/thread_safe_sender.h" |
16 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 16 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
17 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
18 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 18 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
19 #include "content/gpu/gpu_process_control_impl.h" | 19 #include "content/gpu/gpu_process_control_impl.h" |
20 #include "content/gpu/gpu_watchdog_thread.h" | 20 #include "content/gpu/gpu_watchdog_thread.h" |
21 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
23 #include "content/public/gpu/content_gpu_client.h" | 23 #include "content/public/gpu/content_gpu_client.h" |
24 #include "gpu/config/gpu_info_collector.h" | 24 #include "gpu/config/gpu_info_collector.h" |
| 25 #include "gpu/ipc/common/memory_stats.h" |
25 #include "ipc/ipc_channel_handle.h" | 26 #include "ipc/ipc_channel_handle.h" |
26 #include "ipc/ipc_sync_message_filter.h" | 27 #include "ipc/ipc_sync_message_filter.h" |
27 #include "ui/gl/gl_implementation.h" | 28 #include "ui/gl/gl_implementation.h" |
28 #include "ui/gl/gpu_switching_manager.h" | 29 #include "ui/gl/gpu_switching_manager.h" |
29 | 30 |
30 #if defined(USE_OZONE) | 31 #if defined(USE_OZONE) |
31 #include "ui/ozone/public/gpu_platform_support.h" | 32 #include "ui/ozone/public/gpu_platform_support.h" |
32 #include "ui/ozone/public/ozone_platform.h" | 33 #include "ui/ozone/public/ozone_platform.h" |
33 #endif | 34 #endif |
34 | 35 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 345 |
345 #if defined(OS_WIN) | 346 #if defined(OS_WIN) |
346 if (!in_browser_process_) { | 347 if (!in_browser_process_) { |
347 // The unsandboxed GPU process fulfilled its duty. Rest in peace. | 348 // The unsandboxed GPU process fulfilled its duty. Rest in peace. |
348 base::MessageLoop::current()->QuitWhenIdle(); | 349 base::MessageLoop::current()->QuitWhenIdle(); |
349 } | 350 } |
350 #endif // OS_WIN | 351 #endif // OS_WIN |
351 } | 352 } |
352 | 353 |
353 void GpuChildThread::OnGetVideoMemoryUsageStats() { | 354 void GpuChildThread::OnGetVideoMemoryUsageStats() { |
354 GPUVideoMemoryUsageStats video_memory_usage_stats; | 355 gpu::VideoMemoryUsageStats video_memory_usage_stats; |
355 if (gpu_channel_manager_) | 356 if (gpu_channel_manager_) |
356 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( | 357 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( |
357 &video_memory_usage_stats); | 358 &video_memory_usage_stats); |
358 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); | 359 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); |
359 } | 360 } |
360 | 361 |
361 void GpuChildThread::OnClean() { | 362 void GpuChildThread::OnClean() { |
362 DVLOG(1) << "GPU: Removing all contexts"; | 363 DVLOG(1) << "GPU: Removing all contexts"; |
363 if (gpu_channel_manager_) | 364 if (gpu_channel_manager_) |
364 gpu_channel_manager_->LoseAllContexts(); | 365 gpu_channel_manager_->LoseAllContexts(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 400 |
400 void GpuChildThread::BindProcessControlRequest( | 401 void GpuChildThread::BindProcessControlRequest( |
401 mojo::InterfaceRequest<ProcessControl> request) { | 402 mojo::InterfaceRequest<ProcessControl> request) { |
402 DVLOG(1) << "GPU: Binding ProcessControl request"; | 403 DVLOG(1) << "GPU: Binding ProcessControl request"; |
403 DCHECK(process_control_); | 404 DCHECK(process_control_); |
404 process_control_bindings_.AddBinding(process_control_.get(), | 405 process_control_bindings_.AddBinding(process_control_.get(), |
405 std::move(request)); | 406 std::move(request)); |
406 } | 407 } |
407 | 408 |
408 } // namespace content | 409 } // namespace content |
OLD | NEW |