Commit a3aaa8a3 authored by Annie Sullivan's avatar Annie Sullivan Committed by Commit Bot

Add UMA histogram to measure how long beforeunload dialogs are open.

This is part of a larger project to measure page load times starting
at user input. One blocker for this is understanding how the
beforeunload dialog might affect this metric.

Bug: 750639
Change-Id: I7aef267a52353a6852dd82bad6c6c74a6fb82e51
Reviewed-on: https://chromium-review.googlesource.com/1162673
Commit-Queue: Annie Sullivan <sullivan@chromium.org>
Reviewed-by: default avatarShubhie Panicker <panicker@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582992}
parent 03484499
......@@ -3538,8 +3538,16 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client,
String text = before_unload_event.returnValue();
beforeunload_dialog_histogram.Count(
BeforeUnloadDialogHistogramEnum::kShowDialog);
if (chrome_client.OpenBeforeUnloadConfirmPanel(text, frame_, is_reload)) {
did_allow_navigation = true;
const TimeTicks beforeunload_confirmpanel_start = CurrentTimeTicks();
did_allow_navigation =
chrome_client.OpenBeforeUnloadConfirmPanel(text, frame_, is_reload);
const TimeTicks beforeunload_confirmpanel_end = CurrentTimeTicks();
if (did_allow_navigation) {
// Only record when a navigation occurs, since we want to understand
// the impact of the before unload dialog on overall input to navigation.
UMA_HISTOGRAM_MEDIUM_TIMES(
"DocumentEventTiming.BeforeUnloadDialogDuration.ByNavigation",
beforeunload_confirmpanel_end - beforeunload_confirmpanel_start);
return true;
}
......
......@@ -19891,6 +19891,17 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="DocumentEventTiming.BeforeUnloadDialogDuration.ByNavigation"
units="ms" expires_after="2019-08-09">
<owner>sullivan@chromium.org</owner>
<summary>
Milliseconds spent in beforeunload dialog. Does not include time to process
beforeunload event in JavaScript (see
DocumentEventTiming.BeforeUnloadDuration). Recorded immediately after
closing dialog, upon user confirmation to navigate away from the page.
</summary>
</histogram>
<histogram name="DocumentEventTiming.BeforeUnloadDuration" units="microseconds">
<owner>panicker@chromium.org</owner>
<summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment