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

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 2103153004: Add a histogram for delay between first paint and client side redirects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: histogram xml fix Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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,
+ 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
« no previous file with comments | « components/page_load_metrics/browser/metrics_web_contents_observer.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698