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

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: Updated method names and comments. 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 navigation_data_.reset();
davidben 2015/01/28 21:33:26 Should navigation_data_ be a map, or perhaps condi
carlosk 2015/01/30 14:01:47 Indeed we're only interested in main-frame, browse
nasko 2015/02/02 18:28:53 In regular Chrome right now, yes. With Site Isolat
carlosk 2015/02/03 11:00:03 Ack. The future task to move it into NavigationReq
775 } 776 }
776 DCHECK(navigation_request); 777 DCHECK(navigation_request);
777 778
778 // Update the referrer with the one received from the renderer. 779 // Update the referrer with the one received from the renderer.
779 navigation_request->common_params().referrer = common_params.referrer; 780 navigation_request->common_params().referrer = common_params.referrer;
780 781
781 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); 782 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params));
782 783
783 info->first_party_for_cookies = 784 info->first_party_for_cookies =
784 frame_tree_node->IsMainFrame() 785 frame_tree_node->IsMainFrame()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 render_frame_host->CommitNavigation(response, body.Pass(), 827 render_frame_host->CommitNavigation(response, body.Pass(),
827 navigation_request->common_params(), 828 navigation_request->common_params(),
828 navigation_request->commit_params()); 829 navigation_request->commit_params());
829 } 830 }
830 831
831 // PlzNavigate 832 // PlzNavigate
832 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 833 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
833 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 834 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
834 switches::kEnableBrowserSideNavigation)); 835 switches::kEnableBrowserSideNavigation));
835 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); 836 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
837 navigation_data_.reset();
836 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once 838 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once
837 // we properly cancel ongoing navigations. 839 // we properly cancel ongoing navigations.
838 frame_tree_node->render_manager()->CleanUpNavigation(); 840 frame_tree_node->render_manager()->CleanUpNavigation();
839 } 841 }
840 842
841 // PlzNavigate 843 // PlzNavigate
842 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( 844 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting(
843 FrameTreeNode* frame_tree_node) { 845 FrameTreeNode* frame_tree_node) {
844 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 846 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
845 } 847 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 983 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
982 time_to_commit); 984 time_to_commit);
983 UMA_HISTOGRAM_TIMES( 985 UMA_HISTOGRAM_TIMES(
984 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 986 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
985 time_to_network); 987 time_to_network);
986 } 988 }
987 navigation_data_.reset(); 989 navigation_data_.reset();
988 } 990 }
989 991
990 } // namespace content 992 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698