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/cpu.h" | |
11 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/process_util.h" | 15 #include "base/process_util.h" |
15 #include "base/threading/thread.h" | 16 #include "base/threading/thread.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" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) | 264 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) |
264 return g_gpu_process_hosts[kind]; | 265 return g_gpu_process_hosts[kind]; |
265 | 266 |
266 if (cause == CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) | 267 if (cause == CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) |
267 return NULL; | 268 return NULL; |
268 | 269 |
269 static int last_host_id = 0; | 270 static int last_host_id = 0; |
270 int host_id; | 271 int host_id; |
271 host_id = ++last_host_id; | 272 host_id = ++last_host_id; |
272 | 273 |
274 #if defined(ARCH_CPU_X86_FAMILY) | |
275 base::CPU cpu; | |
276 int arch = 0; | |
277 if (cpu.has_sse()) | |
278 arch = 1; | |
apatrick_chromium
2013/01/25 19:06:30
nit: use an enum and comment that it must not be r
| |
279 if (cpu.has_sse2()) | |
280 arch = 2; | |
281 if (cpu.has_sse3()) | |
282 arch = 3; | |
283 if (cpu.has_ssse3()) | |
284 arch = 4; | |
285 if (cpu.has_sse41()) | |
286 arch = 5; | |
287 if (cpu.has_sse42()) | |
288 arch = 6; | |
289 if (cpu.has_avx()) | |
290 arch = 7; | |
291 UMA_HISTOGRAM_ENUMERATION("Platform.IntelMaxuArchSupport", | |
292 arch, | |
293 8); | |
294 #endif // defined(ARCH_CPU_X86_FAMILY) | |
295 | |
273 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLaunchCause", | 296 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLaunchCause", |
274 cause, | 297 cause, |
275 CAUSE_FOR_GPU_LAUNCH_MAX_ENUM); | 298 CAUSE_FOR_GPU_LAUNCH_MAX_ENUM); |
276 | 299 |
277 GpuProcessHost* host = new GpuProcessHost(host_id, kind); | 300 GpuProcessHost* host = new GpuProcessHost(host_id, kind); |
278 if (host->Init()) | 301 if (host->Init()) |
279 return host; | 302 return host; |
280 | 303 |
281 delete host; | 304 delete host; |
282 return NULL; | 305 return NULL; |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1051 void GpuProcessHost::BlockLiveOffscreenContexts() { | 1074 void GpuProcessHost::BlockLiveOffscreenContexts() { |
1052 for (std::multiset<GURL>::iterator iter = | 1075 for (std::multiset<GURL>::iterator iter = |
1053 urls_with_live_offscreen_contexts_.begin(); | 1076 urls_with_live_offscreen_contexts_.begin(); |
1054 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { | 1077 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { |
1055 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( | 1078 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( |
1056 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); | 1079 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); |
1057 } | 1080 } |
1058 } | 1081 } |
1059 | 1082 |
1060 } // namespace content | 1083 } // namespace content |
OLD | NEW |