| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/files/file_util.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 20 #include "base/sha1.h" | 21 #include "base/sha1.h" |
| 21 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 22 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 24 #include "components/tracing/tracing_switches.h" | 25 #include "components/tracing/tracing_switches.h" |
| 25 #include "content/browser/browser_child_process_host_impl.h" | 26 #include "content/browser/browser_child_process_host_impl.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 base::string16 log_file_path = logging::GetLogFileFullPath(); | 253 base::string16 log_file_path = logging::GetLogFileFullPath(); |
| 253 if (!log_file_path.empty()) { | 254 if (!log_file_path.empty()) { |
| 254 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | 255 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
| 255 sandbox::TargetPolicy::FILES_ALLOW_ANY, | 256 sandbox::TargetPolicy::FILES_ALLOW_ANY, |
| 256 log_file_path.c_str()); | 257 log_file_path.c_str()); |
| 257 if (result != sandbox::SBOX_ALL_OK) | 258 if (result != sandbox::SBOX_ALL_OK) |
| 258 return false; | 259 return false; |
| 259 } | 260 } |
| 260 } | 261 } |
| 261 | 262 |
| 263 // Enable GPU watchdog to write to a temp file to test whether I/O |
| 264 // is a bottleneck. |
| 265 base::FilePath temp_dir_path; |
| 266 if (GetTempDir(&temp_dir_path)) { |
| 267 base::FilePath temp_file_path = temp_dir_path.Append(L"gpu-watchdog.tmp"); |
| 268 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
| 269 sandbox::TargetPolicy::FILES_ALLOW_ANY, |
| 270 temp_file_path.value().c_str()); |
| 271 if (result != sandbox::SBOX_ALL_OK) |
| 272 return false; |
| 273 } |
| 274 |
| 262 return true; | 275 return true; |
| 263 } | 276 } |
| 264 #elif defined(OS_POSIX) | 277 #elif defined(OS_POSIX) |
| 265 | 278 |
| 266 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } | 279 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } |
| 267 #endif // OS_WIN | 280 #endif // OS_WIN |
| 268 | 281 |
| 269 SandboxType GetSandboxType() override { | 282 SandboxType GetSandboxType() override { |
| 270 return SANDBOX_TYPE_GPU; | 283 return SANDBOX_TYPE_GPU; |
| 271 } | 284 } |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1184 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1172 ClientIdToShaderCacheMap::iterator iter = | 1185 ClientIdToShaderCacheMap::iterator iter = |
| 1173 client_id_to_shader_cache_.find(client_id); | 1186 client_id_to_shader_cache_.find(client_id); |
| 1174 // If the cache doesn't exist then this is an off the record profile. | 1187 // If the cache doesn't exist then this is an off the record profile. |
| 1175 if (iter == client_id_to_shader_cache_.end()) | 1188 if (iter == client_id_to_shader_cache_.end()) |
| 1176 return; | 1189 return; |
| 1177 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1190 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1178 } | 1191 } |
| 1179 | 1192 |
| 1180 } // namespace content | 1193 } // namespace content |
| OLD | NEW |