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

Unified Diff: content/browser/frame_host/navigation_handle_impl.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_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 2ad3b58d6da54e04fd0c9660f62c82ad4e39416d..e3f08ec054f49655858cd7cfce7019765c45d579 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -455,7 +455,7 @@ NavigationHandleImpl::CallWillRedirectRequestForTesting(
WillRedirectRequest(new_url, new_method_is_post ? "POST" : "GET",
new_referrer_url, new_is_external_protocol,
scoped_refptr<net::HttpResponseHeaders>(),
- net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN,
+ net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, nullptr,
base::Bind(&UpdateThrottleCheckResult, &result));
// Reset the callback to ensure it will not be called later.
@@ -615,6 +615,7 @@ void NavigationHandleImpl::WillRedirectRequest(
bool new_is_external_protocol,
scoped_refptr<net::HttpResponseHeaders> response_headers,
net::HttpResponseInfo::ConnectionInfo connection_info,
+ RenderProcessHost* post_redirect_process,
const ThrottleChecksFinishedCallback& callback) {
TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this,
"WillRedirectRequest", "url",
@@ -623,7 +624,7 @@ void NavigationHandleImpl::WillRedirectRequest(
// Update the navigation parameters.
url_ = new_url;
method_ = new_method;
- UpdateSiteURL();
+ UpdateSiteURL(post_redirect_process);
if (!(transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT)) {
sanitized_referrer_.url = new_referrer_url;
@@ -1153,17 +1154,26 @@ bool NavigationHandleImpl::IsSelfReferentialURL() {
return false;
}
-void NavigationHandleImpl::UpdateSiteURL() {
+void NavigationHandleImpl::UpdateSiteURL(
+ RenderProcessHost* post_redirect_process) {
GURL new_site_url = SiteInstance::GetSiteForURL(
frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
url_);
- if (new_site_url == site_url_)
+ int post_redirect_process_id = post_redirect_process
+ ? post_redirect_process->GetID()
+ : ChildProcessHost::kInvalidUniqueID;
+ if (new_site_url == site_url_ &&
+ post_redirect_process_id == expected_render_process_host_id_) {
return;
+ }
- // When redirecting cross-site, stop telling the speculative
- // RenderProcessHost to expect a navigation commit.
+ // Stop expecting a navigation to the current site URL in the current expected
+ // process.
SetExpectedProcess(nullptr);
+
+ // Update the site URL and the expected process.
site_url_ = new_site_url;
+ SetExpectedProcess(post_redirect_process);
}
} // namespace content
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.h ('k') | content/browser/frame_host/navigation_handle_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698