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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Adding a DCHECK to probably make a lot of tests fail. 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 837845affea10605194a5aaa100922a5901817c4..77b95657f2567c121b5dad5271a38bf21cbcb37f 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2612,6 +2612,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);
@@ -2633,9 +2635,12 @@ void RenderFrameHostImpl::CommitNavigation(
Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
request_params));
- // If a network request was made, update the Previews state.
- if (ShouldMakeNetworkRequestForURL(common_params.url))
+ // If a network request was made, update the LoFi state.
nasko 2017/01/13 19:36:57 nit: Why change Preview back to LoFi? This is chan
arthursonzogni 2017/01/17 15:24:47 Thanks! I missed this line when resolving merge co
+ if (ShouldMakeNetworkRequestForURL(common_params.url) &&
+ !request_params.is_same_document_fragment_change &&
+ !request_params.is_same_document_history_load) {
last_navigation_previews_state_ = common_params.previews_state;
+ }
// TODO(clamy): Release the stream handle once the renderer has finished
// reading it.
@@ -3310,14 +3315,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.
nasko 2017/01/13 19:36:57 I'm not sure I can follow this comment well. Did y
arthursonzogni 2017/01/17 15:24:47 Yes.
if (params.was_within_same_page) {
+ if (IsBrowserSideNavigationEnabled() && is_browser_initiated &&
+ navigation_handle_ && navigation_handle_->IsSamePage() &&
+ navigation_handle_->GetURL() == params.url) {
+ return std::move(navigation_handle_);
+ }
+
// We don't ever expect navigation_handle_ to match, because handles are not
// created for same-page navigations.
nasko 2017/01/13 19:36:57 This comment seems to contradict the new comment a
arthursonzogni 2017/01/17 15:24:48 Okay, I will try to move/rephrase comments.
nasko 2017/01/19 00:43:35 This is awesome! Thanks for the changes, it is muc
- 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