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

Unified Diff: content/browser/tab_contents/render_view_host_manager.cc

Issue 6927014: Avoid exiting the renderer process if it has a pending render view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix pre-render issue. Created 9 years, 8 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: content/browser/tab_contents/render_view_host_manager.cc
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index d08f6abc332278958a504bf9c038105c8726d455..73b19d46998bb5d159f4ad393cab84af3cefb725 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -215,6 +215,12 @@ void RenderViewHostManager::RendererAbortedProvisionalLoad(
// the response is not a download.
}
+void RenderViewHostManager::RendererProcessClosing(
+ RenderProcessHost* render_process_host) {
+ // TODO(creis): Don't schedule new navigations in RenderViewHosts of this
+ // process. (Part of http://crbug.com/65953.)
+}
+
void RenderViewHostManager::ShouldClosePage(bool for_cross_site_transition,
bool proceed) {
if (for_cross_site_transition) {
@@ -463,6 +469,9 @@ bool RenderViewHostManager::CreatePendingRenderView(
instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_->
GetControllerForRenderManager().session_storage_namespace());
+ // Prevent the process from exiting while we're trying to use it.
+ pending_render_view_host_->process()->AddPendingView();
+
bool success = InitRenderView(pending_render_view_host_, entry);
if (success) {
// Don't show the view until we get a DidNavigate from it.
@@ -526,6 +535,9 @@ void RenderViewHostManager::CommitPending() {
render_view_host_ = pending_render_view_host_;
pending_render_view_host_ = NULL;
+ // The process will no longer try to exit, so we can decrement the count.
+ render_view_host_->process()->RemovePendingView();
+
// If the view is gone, then this RenderViewHost died while it was hidden.
// We ignored the RenderViewGone call at the time, so we should send it now
// to make sure the sad tab shows up, etc.
@@ -663,6 +675,9 @@ void RenderViewHostManager::CancelPending() {
pending_render_view_host_ = NULL;
pending_render_view_host->Shutdown();
+ // We no longer need to prevent the process from exiting.
+ pending_render_view_host->process()->RemovePendingView();
+
pending_web_ui_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698