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

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

Issue 789643005: PlzNavigate: make content unit tests work with browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cancel-navigations
Patch Set: Fixed nits Created 5 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 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 // we properly cancel ongoing navigations. 826 // we properly cancel ongoing navigations.
827 frame_tree_node->render_manager()->CleanUpNavigation(); 827 frame_tree_node->render_manager()->CleanUpNavigation();
828 } 828 }
829 829
830 // PlzNavigate 830 // PlzNavigate
831 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( 831 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting(
832 FrameTreeNode* frame_tree_node) { 832 FrameTreeNode* frame_tree_node) {
833 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 833 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
834 } 834 }
835 835
836 bool NavigatorImpl::IsWaitingForBeforeUnloadACK(
837 FrameTreeNode* frame_tree_node) {
838 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
839 switches::kEnableBrowserSideNavigation));
840 NavigationRequest* request =
841 navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
842 if (!request)
843 return false;
844 return request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE;
845 }
846
836 void NavigatorImpl::LogResourceRequestTime( 847 void NavigatorImpl::LogResourceRequestTime(
837 base::TimeTicks timestamp, const GURL& url) { 848 base::TimeTicks timestamp, const GURL& url) {
838 if (navigation_data_ && navigation_data_->url_ == url) { 849 if (navigation_data_ && navigation_data_->url_ == url) {
839 navigation_data_->url_job_start_time_ = timestamp; 850 navigation_data_->url_job_start_time_ = timestamp;
840 UMA_HISTOGRAM_TIMES( 851 UMA_HISTOGRAM_TIMES(
841 "Navigation.TimeToURLJobStart", 852 "Navigation.TimeToURLJobStart",
842 navigation_data_->url_job_start_time_ - navigation_data_->start_time_); 853 navigation_data_->url_job_start_time_ - navigation_data_->start_time_);
843 } 854 }
844 } 855 }
845 856
(...skipping 30 matching lines...) Expand all
876 FrameTreeNode* frame_tree_node, 887 FrameTreeNode* frame_tree_node,
877 const NavigationEntryImpl& entry, 888 const NavigationEntryImpl& entry,
878 NavigationController::ReloadType reload_type, 889 NavigationController::ReloadType reload_type,
879 base::TimeTicks navigation_start) { 890 base::TimeTicks navigation_start) {
880 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 891 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
881 switches::kEnableBrowserSideNavigation)); 892 switches::kEnableBrowserSideNavigation));
882 DCHECK(frame_tree_node); 893 DCHECK(frame_tree_node);
883 int64 frame_tree_node_id = frame_tree_node->frame_tree_node_id(); 894 int64 frame_tree_node_id = frame_tree_node->frame_tree_node_id();
884 FrameMsg_Navigate_Type::Value navigation_type = 895 FrameMsg_Navigate_Type::Value navigation_type =
885 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); 896 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type);
886 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( 897 scoped_ptr<NavigationRequest> navigation_request = NavigationRequest::Create(
887 frame_tree_node, 898 frame_tree_node, entry, navigation_type, navigation_start);
888 CommonNavigationParams(entry.GetURL(), entry.GetReferrer(),
889 entry.GetTransitionType(), navigation_type,
890 !entry.IsViewSourceMode()),
891 CommitNavigationParams(entry.GetPageState(),
892 entry.GetIsOverridingUserAgent(),
893 navigation_start),
894 &entry));
895 RequestNavigationParams request_params(entry.GetHasPostData(), 899 RequestNavigationParams request_params(entry.GetHasPostData(),
896 entry.extra_headers(), 900 entry.extra_headers(),
897 entry.GetBrowserInitiatedPostData()); 901 entry.GetBrowserInitiatedPostData());
898 // TODO(clamy): Check if navigations are blocked and if so store the 902 // TODO(clamy): Check if navigations are blocked and if so store the
899 // parameters. 903 // parameters.
900 904
901 // If there is an ongoing request, replace it. 905 // If there is an ongoing request, replace it.
902 navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass()); 906 navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass());
903 907
904 if (frame_tree_node->current_frame_host()->IsRenderFrameLive()) { 908 if (frame_tree_node->current_frame_host()->IsRenderFrameLive()) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 970 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
967 time_to_commit); 971 time_to_commit);
968 UMA_HISTOGRAM_TIMES( 972 UMA_HISTOGRAM_TIMES(
969 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 973 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
970 time_to_network); 974 time_to_network);
971 } 975 }
972 navigation_data_.reset(); 976 navigation_data_.reset();
973 } 977 }
974 978
975 } // namespace content 979 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698