Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1980263002: GPU Watchdog to check I/O before terminating GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/gpu/gpu_watchdog_thread.h » ('j') | content/gpu/gpu_watchdog_thread.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/gpu/gpu_watchdog_thread.h » ('j') | content/gpu/gpu_watchdog_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698