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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 } | 700 } |
700 | 701 |
701 void NavigationHandleImpl::ReadyToCommitNavigation( | 702 void NavigationHandleImpl::ReadyToCommitNavigation( |
702 RenderFrameHostImpl* render_frame_host) { | 703 RenderFrameHostImpl* render_frame_host) { |
703 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, | 704 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, |
704 "ReadyToCommitNavigation"); | 705 "ReadyToCommitNavigation"); |
705 | 706 |
706 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); | 707 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); |
707 render_frame_host_ = render_frame_host; | 708 render_frame_host_ = render_frame_host; |
708 state_ = READY_TO_COMMIT; | 709 state_ = READY_TO_COMMIT; |
| 710 ready_to_commit_time_ = base::TimeTicks::Now(); |
| 711 |
| 712 // For back-forward navigations, record metrics. |
| 713 if (transition_ & ui::PAGE_TRANSITION_FORWARD_BACK) { |
| 714 bool is_same_process = |
| 715 render_frame_host_->GetProcess()->GetID() == |
| 716 frame_tree_node_->current_frame_host()->GetProcess()->GetID(); |
| 717 UMA_HISTOGRAM_BOOLEAN("Navigation.BackForward.IsSameProcess", |
| 718 is_same_process); |
| 719 UMA_HISTOGRAM_TIMES("Navigation.BackForward.TimeToReadyToCommit", |
| 720 ready_to_commit_time_ - navigation_start_); |
| 721 } |
709 | 722 |
710 if (IsBrowserSideNavigationEnabled()) | 723 if (IsBrowserSideNavigationEnabled()) |
711 SetExpectedProcess(render_frame_host->GetProcess()); | 724 SetExpectedProcess(render_frame_host->GetProcess()); |
712 | 725 |
713 if (!IsRendererDebugURL(url_) && !IsSameDocument()) | 726 if (!IsRendererDebugURL(url_) && !IsSameDocument()) |
714 GetDelegate()->ReadyToCommitNavigation(this); | 727 GetDelegate()->ReadyToCommitNavigation(this); |
715 } | 728 } |
716 | 729 |
717 void NavigationHandleImpl::DidCommitNavigation( | 730 void NavigationHandleImpl::DidCommitNavigation( |
718 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 731 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
(...skipping 10 matching lines...) Expand all Loading... |
729 method_ = params.method; | 742 method_ = params.method; |
730 has_user_gesture_ = (params.gesture == NavigationGestureUser); | 743 has_user_gesture_ = (params.gesture == NavigationGestureUser); |
731 transition_ = params.transition; | 744 transition_ = params.transition; |
732 should_update_history_ = params.should_update_history; | 745 should_update_history_ = params.should_update_history; |
733 render_frame_host_ = render_frame_host; | 746 render_frame_host_ = render_frame_host; |
734 previous_url_ = previous_url; | 747 previous_url_ = previous_url; |
735 base_url_ = params.base_url; | 748 base_url_ = params.base_url; |
736 socket_address_ = params.socket_address; | 749 socket_address_ = params.socket_address; |
737 navigation_type_ = navigation_type; | 750 navigation_type_ = navigation_type; |
738 | 751 |
| 752 // For back-forward navigations, record metrics. |
| 753 if ((transition_ & ui::PAGE_TRANSITION_FORWARD_BACK) && |
| 754 !ready_to_commit_time_.is_null()) { |
| 755 UMA_HISTOGRAM_TIMES("Navigation.BackForward.ReadyToCommitUntilCommit", |
| 756 base::TimeTicks::Now() - ready_to_commit_time_); |
| 757 } |
| 758 |
739 DCHECK(!IsInMainFrame() || navigation_entry_committed) | 759 DCHECK(!IsInMainFrame() || navigation_entry_committed) |
740 << "Only subframe navigations can get here without changing the " | 760 << "Only subframe navigations can get here without changing the " |
741 << "NavigationEntry"; | 761 << "NavigationEntry"; |
742 subframe_entry_committed_ = navigation_entry_committed; | 762 subframe_entry_committed_ = navigation_entry_committed; |
743 | 763 |
744 // If an error page reloads, net_error_code might be 200 but we still want to | 764 // If an error page reloads, net_error_code might be 200 but we still want to |
745 // count it as an error page. | 765 // count it as an error page. |
746 if (params.base_url.spec() == kUnreachableWebDataURL || | 766 if (params.base_url.spec() == kUnreachableWebDataURL || |
747 net_error_code_ != net::OK) { | 767 net_error_code_ != net::OK) { |
748 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, | 768 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_) | 1153 if (new_site_url == site_url_) |
1134 return; | 1154 return; |
1135 | 1155 |
1136 // When redirecting cross-site, stop telling the speculative | 1156 // When redirecting cross-site, stop telling the speculative |
1137 // RenderProcessHost to expect a navigation commit. | 1157 // RenderProcessHost to expect a navigation commit. |
1138 SetExpectedProcess(nullptr); | 1158 SetExpectedProcess(nullptr); |
1139 site_url_ = new_site_url; | 1159 site_url_ = new_site_url; |
1140 } | 1160 } |
1141 | 1161 |
1142 } // namespace content | 1162 } // namespace content |
OLD | NEW |