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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #endif | 84 #endif |
85 | 85 |
86 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 86 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
87 #include "ui/gfx/x/x11_switches.h" // nogncheck | 87 #include "ui/gfx/x/x11_switches.h" // nogncheck |
88 #endif | 88 #endif |
89 | 89 |
90 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 90 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
91 #include "content/browser/gpu/gpu_surface_tracker.h" | 91 #include "content/browser/gpu/gpu_surface_tracker.h" |
92 #endif | 92 #endif |
93 | 93 |
| 94 #if defined(MOJO_SHELL_CLIENT) |
| 95 #include "services/shell/runner/common/client_util.h" |
| 96 #endif |
| 97 |
94 namespace content { | 98 namespace content { |
95 | 99 |
96 bool GpuProcessHost::gpu_enabled_ = true; | 100 bool GpuProcessHost::gpu_enabled_ = true; |
97 bool GpuProcessHost::hardware_gpu_enabled_ = true; | 101 bool GpuProcessHost::hardware_gpu_enabled_ = true; |
98 int GpuProcessHost::gpu_crash_count_ = 0; | 102 int GpuProcessHost::gpu_crash_count_ = 0; |
99 int GpuProcessHost::gpu_recent_crash_count_ = 0; | 103 int GpuProcessHost::gpu_recent_crash_count_ = 0; |
100 bool GpuProcessHost::crashed_before_ = false; | 104 bool GpuProcessHost::crashed_before_ = false; |
101 int GpuProcessHost::swiftshader_crash_count_ = 0; | 105 int GpuProcessHost::swiftshader_crash_count_ = 0; |
102 | 106 |
103 namespace { | 107 namespace { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return true; | 310 return true; |
307 } | 311 } |
308 | 312 |
309 host->ForceShutdown(); | 313 host->ForceShutdown(); |
310 return false; | 314 return false; |
311 } | 315 } |
312 | 316 |
313 // static | 317 // static |
314 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, | 318 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, |
315 CauseForGpuLaunch cause) { | 319 CauseForGpuLaunch cause) { |
| 320 #if defined(MOJO_SHELL_CLIENT) |
| 321 DCHECK(!shell::ShellIsRemote()); |
| 322 #endif |
316 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 323 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
317 | 324 |
318 // Don't grant further access to GPU if it is not allowed. | 325 // Don't grant further access to GPU if it is not allowed. |
319 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 326 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
320 DCHECK(gpu_data_manager); | 327 DCHECK(gpu_data_manager); |
321 if (!gpu_data_manager->GpuAccessAllowed(NULL)) | 328 if (!gpu_data_manager->GpuAccessAllowed(NULL)) |
322 return NULL; | 329 return NULL; |
323 | 330 |
324 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) | 331 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) |
325 return g_gpu_process_hosts[kind]; | 332 return g_gpu_process_hosts[kind]; |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1188 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1182 ClientIdToShaderCacheMap::iterator iter = | 1189 ClientIdToShaderCacheMap::iterator iter = |
1183 client_id_to_shader_cache_.find(client_id); | 1190 client_id_to_shader_cache_.find(client_id); |
1184 // If the cache doesn't exist then this is an off the record profile. | 1191 // If the cache doesn't exist then this is an off the record profile. |
1185 if (iter == client_id_to_shader_cache_.end()) | 1192 if (iter == client_id_to_shader_cache_.end()) |
1186 return; | 1193 return; |
1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1194 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1188 } | 1195 } |
1189 | 1196 |
1190 } // namespace content | 1197 } // namespace content |
OLD | NEW |