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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 914223002: PlzNavigate: Updated navigation cancel policy for renderer-initiated requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Two comment changes Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // PlzNavigate 700 // PlzNavigate
701 void NavigatorImpl::OnBeginNavigation( 701 void NavigatorImpl::OnBeginNavigation(
702 FrameTreeNode* frame_tree_node, 702 FrameTreeNode* frame_tree_node,
703 const CommonNavigationParams& common_params, 703 const CommonNavigationParams& common_params,
704 const BeginNavigationParams& begin_params, 704 const BeginNavigationParams& begin_params,
705 scoped_refptr<ResourceRequestBody> body) { 705 scoped_refptr<ResourceRequestBody> body) {
706 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 706 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
707 switches::kEnableBrowserSideNavigation)); 707 switches::kEnableBrowserSideNavigation));
708 DCHECK(frame_tree_node); 708 DCHECK(frame_tree_node);
709 709
710 // This is a renderer-initiated navigation, so generate a new 710 NavigationRequest* ongoing_navigation_request =
711 // NavigationRequest and store it in the map. 711 navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
712 // TODO(clamy): Renderer-initiated navigations should not always cancel the 712 if (ongoing_navigation_request &&
713 // current one. 713 ongoing_navigation_request->begin_params().has_user_gesture &&
clamy 2015/02/11 17:22:29 I don't think this currently works. In browser ini
carlosk 2015/02/12 12:21:06 And I even knew about it... So I need one more tes
714 !begin_params.has_user_gesture) {
715 // The renderer navigation request is canceled iff a) there is an ongoing
clamy 2015/02/11 17:22:30 This does not cancel the renderer-initiated naviga
carlosk 2015/02/12 12:21:05 I did this instead: s/canceled/ignored
clamy 2015/02/12 18:08:06 The change did not appear in the diff :)
carlosk 2015/02/13 13:44:28 Done now. Sorry about that.
716 // request b) which is user-initiated and c) the renderer request is not
717 // user-initiated.
718 return;
719 }
720 // In all other cases the current navigation, if any, is canceled and a new
clamy 2015/02/11 17:22:29 nit: add an empty line before the comment.
carlosk 2015/02/12 12:21:06 Done.
721 // NavigationRequest is created and store it in the map.
clamy 2015/02/11 17:22:30 s/store it/stored
carlosk 2015/02/12 12:21:06 Done.
714 scoped_ptr<NavigationRequest> navigation_request = 722 scoped_ptr<NavigationRequest> navigation_request =
715 NavigationRequest::CreateRendererInitiated( 723 NavigationRequest::CreateRendererInitiated(
716 frame_tree_node, common_params, begin_params, body); 724 frame_tree_node, common_params, begin_params, body);
717 navigation_request_map_.set( 725 navigation_request_map_.set(
718 frame_tree_node->frame_tree_node_id(), navigation_request.Pass()); 726 frame_tree_node->frame_tree_node_id(), navigation_request.Pass());
719 727
720 if (frame_tree_node->IsMainFrame()) 728 if (frame_tree_node->IsMainFrame())
721 navigation_data_.reset(); 729 navigation_data_.reset();
722 730
723 BeginNavigation(frame_tree_node); 731 BeginNavigation(frame_tree_node);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 925 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
918 time_to_commit); 926 time_to_commit);
919 UMA_HISTOGRAM_TIMES( 927 UMA_HISTOGRAM_TIMES(
920 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 928 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
921 time_to_network); 929 time_to_network);
922 } 930 }
923 navigation_data_.reset(); 931 navigation_data_.reset();
924 } 932 }
925 933
926 } // namespace content 934 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698