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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 55 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
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/runner/common/client_util.h" |
65 #include "ui/base/ui_base_switches.h" | 66 #include "ui/base/ui_base_switches.h" |
66 #include "ui/events/latency_info.h" | 67 #include "ui/events/latency_info.h" |
67 #include "ui/gl/gl_switches.h" | 68 #include "ui/gl/gl_switches.h" |
68 | 69 |
69 #if defined(OS_ANDROID) | 70 #if defined(OS_ANDROID) |
70 #include "base/android/build_info.h" | 71 #include "base/android/build_info.h" |
71 #endif | 72 #endif |
72 | 73 |
73 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
74 #include "base/win/windows_version.h" | 75 #include "base/win/windows_version.h" |
75 #include "content/common/sandbox_win.h" | 76 #include "content/common/sandbox_win.h" |
76 #include "sandbox/win/src/sandbox_policy.h" | 77 #include "sandbox/win/src/sandbox_policy.h" |
77 #include "ui/gfx/switches.h" | 78 #include "ui/gfx/switches.h" |
78 #include "ui/gfx/win/rendering_window_manager.h" | 79 #include "ui/gfx/win/rendering_window_manager.h" |
79 #endif | 80 #endif |
80 | 81 |
81 #if defined(USE_OZONE) | 82 #if defined(USE_OZONE) |
82 #include "ui/ozone/public/ozone_switches.h" | 83 #include "ui/ozone/public/ozone_switches.h" |
83 #endif | 84 #endif |
84 | 85 |
85 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 86 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
86 #include "ui/gfx/x/x11_switches.h" // nogncheck | 87 #include "ui/gfx/x/x11_switches.h" // nogncheck |
87 #endif | 88 #endif |
88 | 89 |
89 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 90 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
90 #include "content/browser/gpu/gpu_surface_tracker.h" | 91 #include "content/browser/gpu/gpu_surface_tracker.h" |
91 #endif | 92 #endif |
92 | 93 |
93 #if defined(MOJO_SHELL_CLIENT) | |
94 #include "services/shell/runner/common/client_util.h" | |
95 #endif | |
96 | |
97 namespace content { | 94 namespace content { |
98 | 95 |
99 bool GpuProcessHost::gpu_enabled_ = true; | 96 bool GpuProcessHost::gpu_enabled_ = true; |
100 bool GpuProcessHost::hardware_gpu_enabled_ = true; | 97 bool GpuProcessHost::hardware_gpu_enabled_ = true; |
101 int GpuProcessHost::gpu_crash_count_ = 0; | 98 int GpuProcessHost::gpu_crash_count_ = 0; |
102 int GpuProcessHost::gpu_recent_crash_count_ = 0; | 99 int GpuProcessHost::gpu_recent_crash_count_ = 0; |
103 bool GpuProcessHost::crashed_before_ = false; | 100 bool GpuProcessHost::crashed_before_ = false; |
104 int GpuProcessHost::swiftshader_crash_count_ = 0; | 101 int GpuProcessHost::swiftshader_crash_count_ = 0; |
105 | 102 |
106 namespace { | 103 namespace { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 !GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()))) { | 306 !GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()))) { |
310 return true; | 307 return true; |
311 } | 308 } |
312 | 309 |
313 host->ForceShutdown(); | 310 host->ForceShutdown(); |
314 return false; | 311 return false; |
315 } | 312 } |
316 | 313 |
317 // static | 314 // static |
318 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, bool force_create) { | 315 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, bool force_create) { |
319 #if defined(MOJO_SHELL_CLIENT) | |
320 DCHECK(!shell::ShellIsRemote()); | 316 DCHECK(!shell::ShellIsRemote()); |
321 #endif | |
322 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 317 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
323 | 318 |
324 // Don't grant further access to GPU if it is not allowed. | 319 // Don't grant further access to GPU if it is not allowed. |
325 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 320 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
326 DCHECK(gpu_data_manager); | 321 DCHECK(gpu_data_manager); |
327 if (!gpu_data_manager->GpuAccessAllowed(NULL)) | 322 if (!gpu_data_manager->GpuAccessAllowed(NULL)) |
328 return NULL; | 323 return NULL; |
329 | 324 |
330 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) | 325 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) |
331 return g_gpu_process_hosts[kind]; | 326 return g_gpu_process_hosts[kind]; |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1173 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1179 ClientIdToShaderCacheMap::iterator iter = | 1174 ClientIdToShaderCacheMap::iterator iter = |
1180 client_id_to_shader_cache_.find(client_id); | 1175 client_id_to_shader_cache_.find(client_id); |
1181 // If the cache doesn't exist then this is an off the record profile. | 1176 // If the cache doesn't exist then this is an off the record profile. |
1182 if (iter == client_id_to_shader_cache_.end()) | 1177 if (iter == client_id_to_shader_cache_.end()) |
1183 return; | 1178 return; |
1184 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1179 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1185 } | 1180 } |
1186 | 1181 |
1187 } // namespace content | 1182 } // namespace content |
OLD | NEW |