OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | |
10 #include "content/browser/appcache/appcache_navigation_handle.h" | 11 #include "content/browser/appcache/appcache_navigation_handle.h" |
11 #include "content/browser/appcache/appcache_service_impl.h" | 12 #include "content/browser/appcache/appcache_service_impl.h" |
12 #include "content/browser/child_process_security_policy_impl.h" | 13 #include "content/browser/child_process_security_policy_impl.h" |
13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 14 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
14 #include "content/browser/frame_host/ancestor_throttle.h" | 15 #include "content/browser/frame_host/ancestor_throttle.h" |
15 #include "content/browser/frame_host/data_url_navigation_throttle.h" | 16 #include "content/browser/frame_host/data_url_navigation_throttle.h" |
16 #include "content/browser/frame_host/debug_urls.h" | 17 #include "content/browser/frame_host/debug_urls.h" |
17 #include "content/browser/frame_host/form_submission_throttle.h" | 18 #include "content/browser/frame_host/form_submission_throttle.h" |
18 #include "content/browser/frame_host/frame_tree_node.h" | 19 #include "content/browser/frame_host/frame_tree_node.h" |
19 #include "content/browser/frame_host/mixed_content_navigation_throttle.h" | 20 #include "content/browser/frame_host/mixed_content_navigation_throttle.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
693 // If the navigation is not deferred, run the callback. | 694 // If the navigation is not deferred, run the callback. |
694 if (result != NavigationThrottle::DEFER) { | 695 if (result != NavigationThrottle::DEFER) { |
695 TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, | 696 TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, |
696 "ProcessResponse", "result", result); | 697 "ProcessResponse", "result", result); |
697 RunCompleteCallback(result); | 698 RunCompleteCallback(result); |
698 } | 699 } |
699 } | 700 } |
700 | 701 |
701 void NavigationHandleImpl::ReadyToCommitNavigation( | 702 void NavigationHandleImpl::ReadyToCommitNavigation( |
702 RenderFrameHostImpl* render_frame_host) { | 703 RenderFrameHostImpl* render_frame_host) { |
704 ready_to_commit_time_ = base::TimeTicks::Now(); | |
nasko
2017/06/13 23:50:07
nit: I'd move this down to where we set the state,
clamy
2017/06/14 13:26:50
Done.
| |
703 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, | 705 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, |
704 "ReadyToCommitNavigation"); | 706 "ReadyToCommitNavigation"); |
705 | 707 |
706 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 708 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
707 render_frame_host_ = render_frame_host; | 709 render_frame_host_ = render_frame_host; |
708 state_ = READY_TO_COMMIT; | 710 state_ = READY_TO_COMMIT; |
709 | 711 |
712 // For back-forward navigations, record metrics. | |
713 if (transition_ & ui::PAGE_TRANSITION_FORWARD_BACK) { | |
714 bool is_same_site = | |
nasko
2017/06/13 23:50:08
nit: is_same_host? is_same_site would imply compar
clamy
2017/06/14 13:26:50
Actually, what I really want to measure is process
| |
715 render_frame_host_ == frame_tree_node_->current_frame_host(); | |
716 UMA_HISTOGRAM_BOOLEAN("Navigation.BackForward.IsSameProcess", is_same_site); | |
nasko
2017/06/13 23:50:08
Similarly here, IsSameRenderFrameHost. If/when we
clamy
2017/06/14 13:26:50
See comment above.
| |
717 UMA_HISTOGRAM_TIMES("Navigation.BackForward.TimeToReadyToCommit", | |
718 ready_to_commit_time_ - navigation_start_); | |
719 } | |
720 | |
710 if (IsBrowserSideNavigationEnabled()) | 721 if (IsBrowserSideNavigationEnabled()) |
711 SetExpectedProcess(render_frame_host->GetProcess()); | 722 SetExpectedProcess(render_frame_host->GetProcess()); |
712 | 723 |
713 if (!IsRendererDebugURL(url_) && !IsSameDocument()) | 724 if (!IsRendererDebugURL(url_) && !IsSameDocument()) |
714 GetDelegate()->ReadyToCommitNavigation(this); | 725 GetDelegate()->ReadyToCommitNavigation(this); |
715 } | 726 } |
716 | 727 |
717 void NavigationHandleImpl::DidCommitNavigation( | 728 void NavigationHandleImpl::DidCommitNavigation( |
718 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 729 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
719 bool navigation_entry_committed, | 730 bool navigation_entry_committed, |
720 bool did_replace_entry, | 731 bool did_replace_entry, |
721 const GURL& previous_url, | 732 const GURL& previous_url, |
722 NavigationType navigation_type, | 733 NavigationType navigation_type, |
723 RenderFrameHostImpl* render_frame_host) { | 734 RenderFrameHostImpl* render_frame_host) { |
724 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 735 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
725 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); | 736 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); |
726 CHECK_EQ(url_, params.url); | 737 CHECK_EQ(url_, params.url); |
727 | 738 |
728 did_replace_entry_ = did_replace_entry; | 739 did_replace_entry_ = did_replace_entry; |
729 method_ = params.method; | 740 method_ = params.method; |
730 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 741 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
731 transition_ = params.transition; | 742 transition_ = params.transition; |
732 should_update_history_ = params.should_update_history; | 743 should_update_history_ = params.should_update_history; |
733 render_frame_host_ = render_frame_host; | 744 render_frame_host_ = render_frame_host; |
734 previous_url_ = previous_url; | 745 previous_url_ = previous_url; |
735 base_url_ = params.base_url; | 746 base_url_ = params.base_url; |
736 socket_address_ = params.socket_address; | 747 socket_address_ = params.socket_address; |
737 navigation_type_ = navigation_type; | 748 navigation_type_ = navigation_type; |
738 | 749 |
750 // For back-forward navigations, record metrics. | |
751 if ((transition_ & ui::PAGE_TRANSITION_FORWARD_BACK) && | |
752 !ready_to_commit_time_.is_null()) { | |
753 UMA_HISTOGRAM_TIMES("Navigation.BackForward.CommitTime", | |
nasko
2017/06/13 23:50:07
nit: Should this be something along the lines of "
clamy
2017/06/14 13:26:50
Done.
| |
754 base::TimeTicks ::Now() - ready_to_commit_time_); | |
nasko
2017/06/13 23:50:08
nit: No need for space between TimeTicks and ::.
clamy
2017/06/14 13:26:50
Done.
| |
755 } | |
756 | |
739 DCHECK(!IsInMainFrame() || navigation_entry_committed) | 757 DCHECK(!IsInMainFrame() || navigation_entry_committed) |
740 << "Only subframe navigations can get here without changing the " | 758 << "Only subframe navigations can get here without changing the " |
741 << "NavigationEntry"; | 759 << "NavigationEntry"; |
742 subframe_entry_committed_ = navigation_entry_committed; | 760 subframe_entry_committed_ = navigation_entry_committed; |
743 | 761 |
744 // If an error page reloads, net_error_code might be 200 but we still want to | 762 // If an error page reloads, net_error_code might be 200 but we still want to |
745 // count it as an error page. | 763 // count it as an error page. |
746 if (params.base_url.spec() == kUnreachableWebDataURL || | 764 if (params.base_url.spec() == kUnreachableWebDataURL || |
747 net_error_code_ != net::OK) { | 765 net_error_code_ != net::OK) { |
748 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, | 766 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1133 if (new_site_url == site_url_) | 1151 if (new_site_url == site_url_) |
1134 return; | 1152 return; |
1135 | 1153 |
1136 // When redirecting cross-site, stop telling the speculative | 1154 // When redirecting cross-site, stop telling the speculative |
1137 // RenderProcessHost to expect a navigation commit. | 1155 // RenderProcessHost to expect a navigation commit. |
1138 SetExpectedProcess(nullptr); | 1156 SetExpectedProcess(nullptr); |
1139 site_url_ = new_site_url; | 1157 site_url_ = new_site_url; |
1140 } | 1158 } |
1141 | 1159 |
1142 } // namespace content | 1160 } // namespace content |
OLD | NEW |