From f3abf10c215c3d281ee52a18a97a004a6d6c6dfd Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Mon, 12 Sep 2011 18:36:03 +0000 Subject: Reset RPH's channel. This is important for shutdown ordering to make sure the objects hanging off the channel get deleted before objects they reference (like data in ResourceContext) go away. BUG=91398 TEST=none Review URL: http://codereview.chromium.org/7796029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100730 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/renderer_host/render_process_host.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'content/browser/renderer_host/render_process_host.cc') diff --git a/content/browser/renderer_host/render_process_host.cc b/content/browser/renderer_host/render_process_host.cc index e34a600..ec097de 100644 --- a/content/browser/renderer_host/render_process_host.cc +++ b/content/browser/renderer_host/render_process_host.cc @@ -114,6 +114,10 @@ RenderProcessHost::~RenderProcessHost() { all_hosts.Remove(id()); } +bool RenderProcessHost::HasConnection() const { + return channel_.get() != NULL; +} + void RenderProcessHost::Attach(IPC::Channel::Listener* listener, int routing_id) { VLOG_IF(1, g_log_bug53991) << "AddListener: (" << this << "): " << routing_id; @@ -136,6 +140,12 @@ void RenderProcessHost::Release(int listener_id) { Source(this), NotificationService::NoDetails()); MessageLoop::current()->DeleteSoon(FROM_HERE, this); deleting_soon_ = true; + // It's important not to wait for the DeleteTask to delete the channel + // proxy. Kill it off now. That way, in case the profile is going away, the + // rest of the objects attached to this RenderProcessHost start going + // away first, since deleting the channel proxy will post a + // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. + channel_.reset(); // Remove ourself from the list of renderer processes so that we can't be // reused in between now and when the Delete task runs. -- cgit v1.1