Bug 1340842 - Add FX_TAB_CLOSE_PERMIT_UNLOAD_TIME_MS probe to measure how long it takes to run permitUnload on a tab when asked to close. r?Mossop, data-review=liuche
MozReview-Commit-ID: 1qvhY6g2p9w
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -2657,19 +2657,25 @@
if (!aTab._pendingPermitUnload &&
!aSkipPermitUnload &&
aTab.linkedPanel &&
!aAdoptedByTab) {
// We need to block while calling permitUnload() because it
// processes the event queue and may lead to another removeTab()
// call before permitUnload() returns.
+
+ TelemetryStopwatch.start("FX_TAB_CLOSE_PERMIT_UNLOAD_TIME_MS", aTab);
+
aTab._pendingPermitUnload = true;
let {permitUnload, timedOut} = browser.permitUnload();
delete aTab._pendingPermitUnload;
+
+ TelemetryStopwatch.finish("FX_TAB_CLOSE_PERMIT_UNLOAD_TIME_MS", aTab);
+
// If we were closed during onbeforeunload, we return false now
// so we don't (try to) close the same tab again. Of course, we
// also stop if the unload was cancelled by the user:
if (aTab.closing || (!timedOut && !permitUnload)) {
// NB: deliberately keep the _closedDuringPermitUnload set to
// true so we keep exiting early in case of multiple calls.
return false;
}
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5043,16 +5043,25 @@
"alert_emails": ["mconley@mozilla.com", "hkirschner@mozilla.com"],
"bug_numbers": [1340842],
"expires_in_version": "60",
"kind": "exponential",
"high": 10000,
"n_buckets": 50,
"description": "Firefox: Time taken from the point of closing a tab (without animation) to the browser element being removed from the DOM. (ms)."
},
+ "FX_TAB_CLOSE_PERMIT_UNLOAD_TIME_MS": {
+ "alert_emails": ["mconley@mozilla.com", "hkirschner@mozilla.com"],
+ "bug_numbers": [1340842],
+ "expires_in_version": "60",
+ "kind": "exponential",
+ "high": 10000,
+ "n_buckets": 50,
+ "description": "Firefox: Time taken to run permitUnload on a browser during tab close to see whether or not we're allowed to close the tab (ms)."
+ },
"FX_TAB_ANIM_OPEN_PREVIEW_FRAME_INTERVAL_MS": {
"expires_in_version": "never",
"kind": "exponential",
"low": 7,
"high": 500,
"n_buckets": 50,
"description": "Average frame interval during tab open animation of about:newtab (preview=on), when other tabs are unaffected"
},