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

Unified Diff: content/browser/memory/memory_coordinator.cc

Issue 2536533002: memory coordinator: Check RenderProcessHost pointers before use them (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_coordinator.cc
diff --git a/content/browser/memory/memory_coordinator.cc b/content/browser/memory/memory_coordinator.cc
index 4600029befd27070e9cf903e1aa852bd483b08f0..cc7436a3e7a293086f55ffdb829a8adf37a5efd8 100644
--- a/content/browser/memory/memory_coordinator.cc
+++ b/content/browser/memory/memory_coordinator.cc
@@ -169,7 +169,7 @@ bool MemoryCoordinator::CanThrottleRenderer(int render_process_id) {
if (!delegate_)
return true;
auto* render_process_host = RenderProcessHost::FromID(render_process_id);
- return render_process_host->IsProcessBackgrounded();
+ return render_process_host && render_process_host->IsProcessBackgrounded();
}
bool MemoryCoordinator::CanSuspendRenderer(int render_process_id) {
@@ -177,8 +177,8 @@ bool MemoryCoordinator::CanSuspendRenderer(int render_process_id) {
if (!delegate_)
return true;
auto* render_process_host = RenderProcessHost::FromID(render_process_id);
- if (!render_process_host->IsProcessBackgrounded())
- return false;
+ if (!render_process_host || !render_process_host->IsProcessBackgrounded())
+ return false;
return delegate_->CanSuspendBackgroundedRenderer(render_process_id);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698