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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "gpu/command_buffer/service/gpu_preferences.h" | 56 #include "gpu/command_buffer/service/gpu_preferences.h" |
57 #include "gpu/command_buffer/service/gpu_switches.h" | 57 #include "gpu/command_buffer/service/gpu_switches.h" |
58 #include "ipc/ipc_channel_handle.h" | 58 #include "ipc/ipc_channel_handle.h" |
59 #include "ipc/ipc_switches.h" | 59 #include "ipc/ipc_switches.h" |
60 #include "ipc/message_filter.h" | 60 #include "ipc/message_filter.h" |
61 #include "media/base/media_switches.h" | 61 #include "media/base/media_switches.h" |
62 #include "mojo/edk/embedder/embedder.h" | 62 #include "mojo/edk/embedder/embedder.h" |
63 #include "services/shell/public/cpp/connection.h" | 63 #include "services/shell/public/cpp/connection.h" |
64 #include "services/shell/public/cpp/interface_provider.h" | 64 #include "services/shell/public/cpp/interface_provider.h" |
65 #include "services/shell/public/cpp/interface_registry.h" | 65 #include "services/shell/public/cpp/interface_registry.h" |
| 66 #include "services/shell/runner/common/client_util.h" |
66 #include "ui/base/ui_base_switches.h" | 67 #include "ui/base/ui_base_switches.h" |
67 #include "ui/events/latency_info.h" | 68 #include "ui/events/latency_info.h" |
68 #include "ui/gl/gl_switches.h" | 69 #include "ui/gl/gl_switches.h" |
69 | 70 |
70 #if defined(OS_ANDROID) | 71 #if defined(OS_ANDROID) |
71 #include "base/android/build_info.h" | 72 #include "base/android/build_info.h" |
72 #endif | 73 #endif |
73 | 74 |
74 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
75 #include "base/win/windows_version.h" | 76 #include "base/win/windows_version.h" |
76 #include "content/common/sandbox_win.h" | 77 #include "content/common/sandbox_win.h" |
77 #include "sandbox/win/src/sandbox_policy.h" | 78 #include "sandbox/win/src/sandbox_policy.h" |
78 #include "ui/gfx/switches.h" | 79 #include "ui/gfx/switches.h" |
79 #include "ui/gfx/win/rendering_window_manager.h" | 80 #include "ui/gfx/win/rendering_window_manager.h" |
80 #endif | 81 #endif |
81 | 82 |
82 #if defined(USE_OZONE) | 83 #if defined(USE_OZONE) |
83 #include "ui/ozone/public/ozone_switches.h" | 84 #include "ui/ozone/public/ozone_switches.h" |
84 #endif | 85 #endif |
85 | 86 |
86 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 87 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
87 #include "ui/gfx/x/x11_switches.h" // nogncheck | 88 #include "ui/gfx/x/x11_switches.h" // nogncheck |
88 #endif | 89 #endif |
89 | 90 |
90 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 91 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
91 #include "content/browser/gpu/gpu_surface_tracker.h" | 92 #include "content/browser/gpu/gpu_surface_tracker.h" |
92 #endif | 93 #endif |
93 | 94 |
94 #if defined(MOJO_SHELL_CLIENT) | |
95 #include "services/shell/runner/common/client_util.h" | |
96 #endif | |
97 | |
98 namespace content { | 95 namespace content { |
99 | 96 |
100 bool GpuProcessHost::gpu_enabled_ = true; | 97 bool GpuProcessHost::gpu_enabled_ = true; |
101 bool GpuProcessHost::hardware_gpu_enabled_ = true; | 98 bool GpuProcessHost::hardware_gpu_enabled_ = true; |
102 int GpuProcessHost::gpu_crash_count_ = 0; | 99 int GpuProcessHost::gpu_crash_count_ = 0; |
103 int GpuProcessHost::gpu_recent_crash_count_ = 0; | 100 int GpuProcessHost::gpu_recent_crash_count_ = 0; |
104 bool GpuProcessHost::crashed_before_ = false; | 101 bool GpuProcessHost::crashed_before_ = false; |
105 int GpuProcessHost::swiftshader_crash_count_ = 0; | 102 int GpuProcessHost::swiftshader_crash_count_ = 0; |
106 | 103 |
107 namespace { | 104 namespace { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return true; | 309 return true; |
313 } | 310 } |
314 | 311 |
315 host->ForceShutdown(); | 312 host->ForceShutdown(); |
316 return false; | 313 return false; |
317 } | 314 } |
318 | 315 |
319 // static | 316 // static |
320 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, | 317 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, |
321 CauseForGpuLaunch cause) { | 318 CauseForGpuLaunch cause) { |
322 #if defined(MOJO_SHELL_CLIENT) | |
323 DCHECK(!shell::ShellIsRemote()); | 319 DCHECK(!shell::ShellIsRemote()); |
324 #endif | |
325 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 320 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
326 | 321 |
327 // Don't grant further access to GPU if it is not allowed. | 322 // Don't grant further access to GPU if it is not allowed. |
328 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 323 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
329 DCHECK(gpu_data_manager); | 324 DCHECK(gpu_data_manager); |
330 if (!gpu_data_manager->GpuAccessAllowed(NULL)) | 325 if (!gpu_data_manager->GpuAccessAllowed(NULL)) |
331 return NULL; | 326 return NULL; |
332 | 327 |
333 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) | 328 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) |
334 return g_gpu_process_hosts[kind]; | 329 return g_gpu_process_hosts[kind]; |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1187 ClientIdToShaderCacheMap::iterator iter = | 1182 ClientIdToShaderCacheMap::iterator iter = |
1188 client_id_to_shader_cache_.find(client_id); | 1183 client_id_to_shader_cache_.find(client_id); |
1189 // If the cache doesn't exist then this is an off the record profile. | 1184 // If the cache doesn't exist then this is an off the record profile. |
1190 if (iter == client_id_to_shader_cache_.end()) | 1185 if (iter == client_id_to_shader_cache_.end()) |
1191 return; | 1186 return; |
1192 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1193 } | 1188 } |
1194 | 1189 |
1195 } // namespace content | 1190 } // namespace content |
OLD | NEW |