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

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 2954623003: PlzNavigate: implement REUSE_COMMITTED_OR_PENDING_SITE for redirects (Closed)
Patch Set: Addressed Charlie's comments Created 3 years, 6 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/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 95bc35fb3f83407c51ba0257e2780d0dfe8694d3..1bf4ec3144b20c4ee63ab773c081543f27264a36 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -553,6 +553,25 @@ void NavigationRequest::OnRequestRedirected(
}
}
+ // Compute the SiteInstance to use for the redirect and pass its
+ // RenderProcessHost if it has a process. Keep a reference if it has a
+ // process, so that the SiteInstance and its associated process aren't deleted
+ // before the navigation is ready to commit.
+ scoped_refptr<SiteInstance> site_instance =
+ frame_tree_node_->render_manager()->GetSiteInstanceForNavigationRequest(
+ *this);
+ speculative_site_instance_ =
+ site_instance->HasProcess() ? site_instance : nullptr;
+
+ // Check what the process of the SiteInstance is. It will be passed to the
+ // NavigationHandle, and informed to expect a navigation to the redirected
+ // URL.
+ // Note: calling GetProcess on the SiteInstance can lead to the creation of a
+ // new process if it doesn't have one. In this case, it should only be called
+ // on a SiteInstance that already has a process.
+ RenderProcessHost* expected_process =
+ site_instance->HasProcess() ? site_instance->GetProcess() : nullptr;
+
// It's safe to use base::Unretained because this NavigationRequest owns the
// NavigationHandle where the callback will be stored.
bool is_external_protocol =
@@ -560,7 +579,7 @@ void NavigationRequest::OnRequestRedirected(
navigation_handle_->WillRedirectRequest(
common_params_.url, common_params_.method, common_params_.referrer.url,
is_external_protocol, response->head.headers,
- response->head.connection_info,
+ response->head.connection_info, expected_process,
base::Bind(&NavigationRequest::OnRedirectChecksComplete,
base::Unretained(this)));
}
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/render_frame_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698