Chromium Code Reviews| Index: components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| index a90e574f9c9239db700707c45a16269e40bbca4d..617d7d6d211ed1b8283e168b81edebda28cde8f5 100644 |
| --- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| +++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc |
| @@ -46,6 +46,8 @@ const char kAbortChainSizeSameURL[] = |
| "PageLoad.Internal.ProvisionalAbortChainSize.SameURL"; |
| const char kAbortChainSizeNoCommit[] = |
| "PageLoad.Internal.ProvisionalAbortChainSize.NoCommit"; |
| +const char kClientRedirectDelayAfterPaint[] = |
| + "PageLoad.Internal.ClientRedirectDelayAfterPaint"; |
| } // namespace internal |
| @@ -385,6 +387,19 @@ void PageLoadTracker::OnInputEvent(const blink::WebInputEvent& event) { |
| } |
| } |
| +void PageLoadTracker::NotifyClientRedirectTo( |
| + const PageLoadTracker& destination) { |
| + base::TimeDelta redirect_delay_after_paint; |
| + if (!timing_.first_paint.is_zero()) { |
| + base::TimeTicks first_paint_time = navigation_start() + timing_.first_paint; |
| + if (destination.navigation_start() > first_paint_time) |
| + redirect_delay_after_paint = |
| + destination.navigation_start() - first_paint_time; |
| + } |
| + PAGE_LOAD_HISTOGRAM(internal::kClientRedirectDelayAfterPaint, |
|
Charlie Harrison
2016/06/29 20:18:37
I don't think it's necessary but let's keep in min
|
| + redirect_delay_after_paint); |
| +} |
| + |
| bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing, |
| const PageLoadMetadata& new_metadata) { |
| // Throw away IPCs that are not relevant to the current navigation. |
| @@ -720,6 +735,12 @@ void MetricsWebContentsObserver::DidFinishNavigation( |
| if (navigation_handle->IsSamePage()) |
| return; |
| + if (!navigation_handle->HasUserGesture() && |
| + (navigation_handle->GetPageTransition() & |
| + ui::PAGE_TRANSITION_CLIENT_REDIRECT) != 0 && |
| + committed_load_) |
| + committed_load_->NotifyClientRedirectTo(*finished_nav); |
| + |
| // Notify other loads that they may have been aborted by this committed load. |
| // Note that by using the committed navigation start as the abort cause, we |
| // lose data on provisional loads that were aborted by other provisional |