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/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "base/threading/worker_pool.h" |
16 #include "content/browser/browser_child_process_host_impl.h" | 17 #include "content/browser/browser_child_process_host_impl.h" |
17 #include "content/browser/gpu/gpu_data_manager_impl.h" | 18 #include "content/browser/gpu/gpu_data_manager_impl.h" |
18 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 19 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
19 #include "content/browser/gpu/gpu_surface_tracker.h" | 20 #include "content/browser/gpu/gpu_surface_tracker.h" |
20 #include "content/browser/renderer_host/render_widget_helper.h" | 21 #include "content/browser/renderer_host/render_widget_helper.h" |
21 #include "content/browser/renderer_host/render_widget_host_impl.h" | 22 #include "content/browser/renderer_host/render_widget_host_impl.h" |
22 #include "content/common/child_process_host_impl.h" | 23 #include "content/common/child_process_host_impl.h" |
23 #include "content/common/gpu/gpu_messages.h" | 24 #include "content/common/gpu/gpu_messages.h" |
24 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
25 #include "content/gpu/gpu_child_thread.h" | 26 #include "content/gpu/gpu_child_thread.h" |
| 27 #include "content/gpu/gpu_info_collector.h" |
26 #include "content/gpu/gpu_process.h" | 28 #include "content/gpu/gpu_process.h" |
27 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/content_browser_client.h" | 30 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
30 #include "content/public/browser/render_widget_host_view.h" | 32 #include "content/public/browser/render_widget_host_view.h" |
31 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/result_codes.h" | 34 #include "content/public/common/result_codes.h" |
33 #include "gpu/command_buffer/service/gpu_switches.h" | 35 #include "gpu/command_buffer/service/gpu_switches.h" |
34 #include "ipc/ipc_channel_handle.h" | 36 #include "ipc/ipc_channel_handle.h" |
35 #include "ipc/ipc_switches.h" | 37 #include "ipc/ipc_switches.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 int sync_point) { | 649 int sync_point) { |
648 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage"); | 650 TRACE_EVENT0("gpu", "GpuProcessHost::DeleteImage"); |
649 | 651 |
650 DCHECK(CalledOnValidThread()); | 652 DCHECK(CalledOnValidThread()); |
651 | 653 |
652 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point)); | 654 Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point)); |
653 } | 655 } |
654 | 656 |
655 void GpuProcessHost::OnInitialized(bool result) { | 657 void GpuProcessHost::OnInitialized(bool result) { |
656 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); | 658 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
| 659 |
| 660 #if defined(OS_WIN) |
| 661 // Only collect D3D11 statistics if D3D was successfully initialized in |
| 662 // the GPU process. |
| 663 if (result) { |
| 664 base::WorkerPool::PostTask( |
| 665 FROM_HERE, |
| 666 base::Bind(&gpu_info_collector::CollectD3D11Support), |
| 667 false); |
| 668 } |
| 669 #endif |
657 } | 670 } |
658 | 671 |
659 void GpuProcessHost::OnChannelEstablished( | 672 void GpuProcessHost::OnChannelEstablished( |
660 const IPC::ChannelHandle& channel_handle) { | 673 const IPC::ChannelHandle& channel_handle) { |
661 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); | 674 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); |
662 | 675 |
663 EstablishChannelCallback callback = channel_requests_.front(); | 676 EstablishChannelCallback callback = channel_requests_.front(); |
664 channel_requests_.pop(); | 677 channel_requests_.pop(); |
665 | 678 |
666 // Currently if any of the GPU features are blacklisted, we don't establish a | 679 // Currently if any of the GPU features are blacklisted, we don't establish a |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 void GpuProcessHost::BlockLiveOffscreenContexts() { | 1068 void GpuProcessHost::BlockLiveOffscreenContexts() { |
1056 for (std::multiset<GURL>::iterator iter = | 1069 for (std::multiset<GURL>::iterator iter = |
1057 urls_with_live_offscreen_contexts_.begin(); | 1070 urls_with_live_offscreen_contexts_.begin(); |
1058 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { | 1071 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { |
1059 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( | 1072 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( |
1060 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); | 1073 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); |
1061 } | 1074 } |
1062 } | 1075 } |
1063 | 1076 |
1064 } // namespace content | 1077 } // namespace content |
OLD | NEW |