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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Fix 2 WebContentsImplTest by assigning a document_sequence_number. Created 3 years, 11 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/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index c42b652ded6a67958017054adbe9120a359087a5..8c48498c38ba8765b12c868f056a220932cae98a 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2618,6 +2618,8 @@ void RenderFrameHostImpl::CommitNavigation(
DCHECK((response && body.get()) ||
common_params.url.SchemeIs(url::kDataScheme) ||
!ShouldMakeNetworkRequestForURL(common_params.url) ||
+ request_params.is_same_document_fragment_change ||
+ request_params.is_same_document_history_load ||
IsRendererDebugURL(common_params.url));
UpdatePermissionsForNavigation(common_params, request_params);
@@ -2640,8 +2642,11 @@ void RenderFrameHostImpl::CommitNavigation(
request_params));
// If a network request was made, update the LoFi state.
- if (ShouldMakeNetworkRequestForURL(common_params.url))
+ if (ShouldMakeNetworkRequestForURL(common_params.url) &&
+ !request_params.is_same_document_fragment_change &&
+ !request_params.is_same_document_history_load) {
last_navigation_lofi_state_ = common_params.lofi_state;
+ }
// TODO(clamy): Release the stream handle once the renderer has finished
// reading it.
@@ -3316,14 +3321,25 @@ void RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError() {
std::unique_ptr<NavigationHandleImpl>
RenderFrameHostImpl::TakeNavigationHandleForCommit(
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ bool is_browser_initiated = (params.nav_entry_id != 0);
+
// If this is a same-page navigation, there isn't an existing NavigationHandle
// to use for the navigation. Create one, but don't reset any NavigationHandle
// tracking an ongoing navigation, since this may lead to the cancellation of
// the navigation.
+ // PlzNavigate: This doesn't apply for browser-initiated same-page navigation,
+ // because a NavigationHandle is created.
if (params.was_within_same_page) {
+ if (IsBrowserSideNavigationEnabled() && is_browser_initiated &&
+ navigation_handle_ && navigation_handle_->IsSamePage() &&
+ navigation_handle_->GetURL() == params.url) {
nasko 2017/01/10 00:19:00 Why is the URL check needed here? Also, if it is a
clamy 2017/01/10 10:52:54 This is checking whether we are comitting a naviga
arthursonzogni 2017/01/12 17:32:30 Yes, we have to check that the current navigation_
+ return std::move(navigation_handle_);
+ }
+
// We don't ever expect navigation_handle_ to match, because handles are not
// created for same-page navigations.
- DCHECK(!navigation_handle_ || !navigation_handle_->IsSamePage());
+ DCHECK(IsBrowserSideNavigationEnabled() || !navigation_handle_ ||
+ !navigation_handle_->IsSamePage());
// First, determine if the navigation corresponds to the pending navigation
// entry. This is the case for a browser-initiated same-page navigation,

Powered by Google App Engine
This is Rietveld 408576698