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

Unified Diff: content/browser/android/content_view_statics.cc

Issue 204933002: Fix crash introduced in https://codereview.chromium.org/179123002/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rmoever override Created 6 years, 9 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 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/android/content_view_statics.cc
diff --git a/content/browser/android/content_view_statics.cc b/content/browser/android/content_view_statics.cc
index aa7ebff397f0efbe4ab33b6500eb57f5312dc5a6..b6cfde1994e00aef70b738de245456fa7f901d49 100644
--- a/content/browser/android/content_view_statics.cc
+++ b/content/browser/android/content_view_statics.cc
@@ -44,12 +44,12 @@ class SuspendedProcessWatcher : public content::RenderProcessHostObserver {
base::ProcessHandle handle,
base::TerminationStatus status,
int exit_code) OVERRIDE {
- std::vector<int>::iterator pos = std::find(suspended_processes_.begin(),
- suspended_processes_.end(),
- host->GetID());
- DCHECK_NE(pos, suspended_processes_.end());
- host->RemoveObserver(this);
- suspended_processes_.erase(pos);
+ StopWatching(host);
+ }
+
+ virtual void RenderProcessHostDestroyed(
+ content::RenderProcessHost* host) OVERRIDE {
+ StopWatching(host);
}
// Suspends timers in all current render processes.
@@ -82,6 +82,15 @@ class SuspendedProcessWatcher : public content::RenderProcessHostObserver {
}
private:
+ void StopWatching(content::RenderProcessHost* host) {
+ std::vector<int>::iterator pos = std::find(suspended_processes_.begin(),
+ suspended_processes_.end(),
+ host->GetID());
+ DCHECK_NE(pos, suspended_processes_.end());
+ host->RemoveObserver(this);
+ suspended_processes_.erase(pos);
+ }
+
std::vector<int /* RenderProcessHost id */> suspended_processes_;
};
« 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