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

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 CR feedback Created 4 years, 6 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/common/gpu_watchdog_utils.h » ('j') | no next file with comments »
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 <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/base64.h" 13 #include "base/base64.h"
14 #include "base/base_switches.h" 14 #include "base/base_switches.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/callback_helpers.h" 16 #include "base/callback_helpers.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/files/file_util.h"
18 #include "base/logging.h" 19 #include "base/logging.h"
19 #include "base/macros.h" 20 #include "base/macros.h"
20 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
21 #include "base/metrics/field_trial.h" 22 #include "base/metrics/field_trial.h"
22 #include "base/metrics/histogram_macros.h" 23 #include "base/metrics/histogram_macros.h"
23 #include "base/sha1.h" 24 #include "base/sha1.h"
24 #include "base/threading/thread.h" 25 #include "base/threading/thread.h"
25 #include "base/trace_event/trace_event.h" 26 #include "base/trace_event/trace_event.h"
26 #include "build/build_config.h" 27 #include "build/build_config.h"
27 #include "components/tracing/common/tracing_switches.h" 28 #include "components/tracing/common/tracing_switches.h"
28 #include "content/browser/browser_child_process_host_impl.h" 29 #include "content/browser/browser_child_process_host_impl.h"
29 #include "content/browser/gpu/compositor_util.h" 30 #include "content/browser/gpu/compositor_util.h"
30 #include "content/browser/gpu/gpu_data_manager_impl.h" 31 #include "content/browser/gpu/gpu_data_manager_impl.h"
31 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 32 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
32 #include "content/browser/gpu/shader_disk_cache.h" 33 #include "content/browser/gpu/shader_disk_cache.h"
33 #include "content/browser/mojo/mojo_application_host.h" 34 #include "content/browser/mojo/mojo_application_host.h"
34 #include "content/browser/renderer_host/render_widget_host_impl.h" 35 #include "content/browser/renderer_host/render_widget_host_impl.h"
35 #include "content/common/child_process_host_impl.h" 36 #include "content/common/child_process_host_impl.h"
36 #include "content/common/establish_channel_params.h" 37 #include "content/common/establish_channel_params.h"
37 #include "content/common/gpu_host_messages.h" 38 #include "content/common/gpu_host_messages.h"
39 #include "content/common/gpu_watchdog_utils.h"
38 #include "content/common/in_process_child_thread_params.h" 40 #include "content/common/in_process_child_thread_params.h"
39 #include "content/common/view_messages.h" 41 #include "content/common/view_messages.h"
40 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
41 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
42 #include "content/public/browser/gpu_utils.h" 44 #include "content/public/browser/gpu_utils.h"
43 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
44 #include "content/public/browser/render_widget_host_view.h" 46 #include "content/public/browser/render_widget_host_view.h"
45 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 47 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
46 #include "content/public/common/content_client.h" 48 #include "content/public/common/content_client.h"
47 #include "content/public/common/content_switches.h" 49 #include "content/public/common/content_switches.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 base::string16 log_file_path = logging::GetLogFileFullPath(); 259 base::string16 log_file_path = logging::GetLogFileFullPath();
258 if (!log_file_path.empty()) { 260 if (!log_file_path.empty()) {
259 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, 261 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
260 sandbox::TargetPolicy::FILES_ALLOW_ANY, 262 sandbox::TargetPolicy::FILES_ALLOW_ANY,
261 log_file_path.c_str()); 263 log_file_path.c_str());
262 if (result != sandbox::SBOX_ALL_OK) 264 if (result != sandbox::SBOX_ALL_OK)
263 return false; 265 return false;
264 } 266 }
265 } 267 }
266 268
269 // Enable GPU watchdog to write to a temp file to delay crashing when
270 // there is a high I/O activitiy.
271 base::FilePath temp_file_path;
272 if (content::GetGpuWatchdogTempFile(&temp_file_path)) {
273 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
274 sandbox::TargetPolicy::FILES_ALLOW_ANY,
275 temp_file_path.value().c_str());
276 if (result != sandbox::SBOX_ALL_OK)
277 return false;
278 }
279
267 return true; 280 return true;
268 } 281 }
269 #elif defined(OS_POSIX) 282 #elif defined(OS_POSIX)
270 283
271 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } 284 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
272 #endif // OS_WIN 285 #endif // OS_WIN
273 286
274 SandboxType GetSandboxType() override { 287 SandboxType GetSandboxType() override {
275 return SANDBOX_TYPE_GPU; 288 return SANDBOX_TYPE_GPU;
276 } 289 }
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1204 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1192 ClientIdToShaderCacheMap::iterator iter = 1205 ClientIdToShaderCacheMap::iterator iter =
1193 client_id_to_shader_cache_.find(client_id); 1206 client_id_to_shader_cache_.find(client_id);
1194 // If the cache doesn't exist then this is an off the record profile. 1207 // If the cache doesn't exist then this is an off the record profile.
1195 if (iter == client_id_to_shader_cache_.end()) 1208 if (iter == client_id_to_shader_cache_.end())
1196 return; 1209 return;
1197 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1210 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1198 } 1211 }
1199 1212
1200 } // namespace content 1213 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu_watchdog_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698