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

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

Issue 2954623003: PlzNavigate: implement REUSE_COMMITTED_OR_PENDING_SITE for redirects (Closed)
Patch Set: 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..48a910e60ce1f081379f996e3ae5ed75ff224e08 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* new_expected_render_process_host,
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(new_expected_render_process_host);
if (!(transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT)) {
sanitized_referrer_.url = new_referrer_url;
@@ -1153,17 +1154,27 @@ bool NavigationHandleImpl::IsSelfReferentialURL() {
return false;
}
-void NavigationHandleImpl::UpdateSiteURL() {
+void NavigationHandleImpl::UpdateSiteURL(
+ RenderProcessHost* new_expected_render_process_host) {
GURL new_site_url = SiteInstance::GetSiteForURL(
frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
url_);
- if (new_site_url == site_url_)
+ int new_expected_render_process_host_id =
+ new_expected_render_process_host
+ ? new_expected_render_process_host->GetID()
+ : ChildProcessHost::kInvalidUniqueID;
+ if (new_site_url == site_url_ &&
+ new_expected_render_process_host_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(new_expected_render_process_host);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698