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

Unified Diff: chrome/browser/renderer_host/render_process_host.cc

Issue 42054: Stop using renderer specific host ids in ResourceDispatcher. This allows it ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
Index: chrome/browser/renderer_host/render_process_host.cc
===================================================================
--- chrome/browser/renderer_host/render_process_host.cc (revision 11493)
+++ chrome/browser/renderer_host/render_process_host.cc (working copy)
@@ -52,8 +52,6 @@
// Returns true if the given host is suitable for launching a new view
// associated with the given profile.
-// TODO(jabdelmalek): do we want to avoid processes with hung renderers
-// or with a large memory consumption?
static bool IsSuitableHost(Profile* profile, RenderProcessHost* host) {
return host->profile() == profile;
}
@@ -68,8 +66,8 @@
RenderProcessHost::RenderProcessHost(Profile* profile)
: max_page_id_(-1),
notified_termination_(false),
+ pid_(-1),
profile_(profile) {
- host_id_ = all_hosts.Add(this);
}
RenderProcessHost::~RenderProcessHost() {
@@ -97,7 +95,10 @@
Details<bool>(&close_expected));
notified_termination_ = true;
}
- Unregister();
+ if (pid_ >= 0) {
+ all_hosts.Remove(pid_);
+ pid_ = -1;
+ }
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
}
@@ -167,9 +168,12 @@
return NULL;
}
-void RenderProcessHost::Unregister() {
- if (host_id_ >= 0) {
- all_hosts.Remove(host_id_);
- host_id_ = -1;
+void RenderProcessHost::SetProcessID(int pid) {
+ if (pid_ != -1) {
+ // This object is being reused after a renderer crash. Remove the old pid.
+ all_hosts.Remove(pid_);
}
+
+ pid_ = pid;
+ all_hosts.AddWithID(this, pid);
}
« no previous file with comments | « chrome/browser/renderer_host/render_process_host.h ('k') | chrome/browser/renderer_host/render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698