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

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

Issue 874353003: New TimeToFirstURLJob* navigation metrics now work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final method name change. 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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 // navigation may start in a renderer and commit in another one. 765 // navigation may start in a renderer and commit in another one.
766 // TODO(clamy): See if the navigation start time should be measured in the 766 // TODO(clamy): See if the navigation start time should be measured in the
767 // renderer and sent to the browser instead of being measured here. 767 // renderer and sent to the browser instead of being measured here.
768 scoped_ptr<NavigationRequest> scoped_request(new NavigationRequest( 768 scoped_ptr<NavigationRequest> scoped_request(new NavigationRequest(
769 frame_tree_node, common_params, 769 frame_tree_node, common_params,
770 CommitNavigationParams(PageState(), false, base::TimeTicks::Now()), 770 CommitNavigationParams(PageState(), false, base::TimeTicks::Now()),
771 nullptr)); 771 nullptr));
772 navigation_request = scoped_request.get(); 772 navigation_request = scoped_request.get();
773 navigation_request_map_.set( 773 navigation_request_map_.set(
774 frame_tree_node->frame_tree_node_id(), scoped_request.Pass()); 774 frame_tree_node->frame_tree_node_id(), scoped_request.Pass());
775
776 if (frame_tree_node->IsMainFrame())
777 navigation_data_.reset();
775 } 778 }
776 DCHECK(navigation_request); 779 DCHECK(navigation_request);
777 780
778 // Update the referrer with the one received from the renderer. 781 // Update the referrer with the one received from the renderer.
779 navigation_request->common_params().referrer = common_params.referrer; 782 navigation_request->common_params().referrer = common_params.referrer;
780 783
781 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); 784 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params));
782 785
783 info->first_party_for_cookies = 786 info->first_party_for_cookies =
784 frame_tree_node->IsMainFrame() 787 frame_tree_node->IsMainFrame()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 render_frame_host->CommitNavigation(response, body.Pass(), 829 render_frame_host->CommitNavigation(response, body.Pass(),
827 navigation_request->common_params(), 830 navigation_request->common_params(),
828 navigation_request->commit_params()); 831 navigation_request->commit_params());
829 } 832 }
830 833
831 // PlzNavigate 834 // PlzNavigate
832 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 835 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
833 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 836 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
834 switches::kEnableBrowserSideNavigation)); 837 switches::kEnableBrowserSideNavigation));
835 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); 838 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
839 if (frame_tree_node->IsMainFrame())
840 navigation_data_.reset();
836 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once 841 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once
837 // we properly cancel ongoing navigations. 842 // we properly cancel ongoing navigations.
838 frame_tree_node->render_manager()->CleanUpNavigation(); 843 frame_tree_node->render_manager()->CleanUpNavigation();
839 } 844 }
840 845
841 // PlzNavigate 846 // PlzNavigate
842 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( 847 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting(
843 FrameTreeNode* frame_tree_node) { 848 FrameTreeNode* frame_tree_node) {
844 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 849 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
845 } 850 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 void NavigatorImpl::RecordNavigationMetrics( 942 void NavigatorImpl::RecordNavigationMetrics(
938 const LoadCommittedDetails& details, 943 const LoadCommittedDetails& details,
939 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 944 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
940 SiteInstance* site_instance) { 945 SiteInstance* site_instance) {
941 DCHECK(site_instance->HasProcess()); 946 DCHECK(site_instance->HasProcess());
942 947
943 if (!details.is_in_page) 948 if (!details.is_in_page)
944 RecordAction(base::UserMetricsAction("FrameLoad")); 949 RecordAction(base::UserMetricsAction("FrameLoad"));
945 950
946 if (!details.is_main_frame || !navigation_data_ || 951 if (!details.is_main_frame || !navigation_data_ ||
952 navigation_data_->url_job_start_time_.is_null() ||
947 navigation_data_->url_ != params.original_request_url) { 953 navigation_data_->url_ != params.original_request_url) {
948 return; 954 return;
949 } 955 }
950 956
951 base::TimeDelta time_to_commit = 957 base::TimeDelta time_to_commit =
952 base::TimeTicks::Now() - navigation_data_->start_time_; 958 base::TimeTicks::Now() - navigation_data_->start_time_;
953 UMA_HISTOGRAM_TIMES("Navigation.TimeToCommit", time_to_commit); 959 UMA_HISTOGRAM_TIMES("Navigation.TimeToCommit", time_to_commit);
954 960
955 time_to_commit -= navigation_data_->before_unload_delay_; 961 time_to_commit -= navigation_data_->before_unload_delay_;
956 base::TimeDelta time_to_network = navigation_data_->url_job_start_time_ - 962 base::TimeDelta time_to_network = navigation_data_->url_job_start_time_ -
(...skipping 24 matching lines...) Expand all
981 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 987 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
982 time_to_commit); 988 time_to_commit);
983 UMA_HISTOGRAM_TIMES( 989 UMA_HISTOGRAM_TIMES(
984 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 990 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
985 time_to_network); 991 time_to_network);
986 } 992 }
987 navigation_data_.reset(); 993 navigation_data_.reset();
988 } 994 }
989 995
990 } // namespace content 996 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator.h ('k') | content/browser/loader/navigation_url_loader_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698