Bug 1340842 - Add FX_TAB_CLOSE_TIME_MS probe to measure how long it takes for tabs to close. r?Mossop, data-review?liuche
MozReview-Commit-ID: J4MzsiwaLcT
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -2550,16 +2550,18 @@
[]
</field>
<method name="removeTab">
<parameter name="aTab"/>
<parameter name="aParams"/>
<body>
<![CDATA[
+ TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_MS", aTab);
+
if (aParams) {
var animate = aParams.animate;
var byMouse = aParams.byMouse;
var skipPermitUnload = aParams.skipPermitUnload;
}
window.maybeRecordAbandonmentTelemetry(aTab, "tabClosed");
@@ -2568,18 +2570,20 @@
if (!animate &&
aTab.closing) {
this._endRemoveTab(aTab);
return;
}
var isLastTab = (this.tabs.length - this._removingTabs.length == 1);
- if (!this._beginRemoveTab(aTab, null, null, true, skipPermitUnload))
+ if (!this._beginRemoveTab(aTab, null, null, true, skipPermitUnload)) {
+ TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_MS", aTab);
return;
+ }
if (!aTab.pinned && !aTab.hidden && aTab._fullyOpen && byMouse)
this.tabContainer._lockTabSizing(aTab);
else
this.tabContainer._unlockTabSizing();
if (!animate /* the caller didn't opt in */ ||
isLastTab ||
@@ -2842,16 +2846,21 @@
// Release the browser in case something is erroneously holding a
// reference to the tab after its removal.
this._tabForBrowser.delete(aTab.linkedBrowser);
aTab.linkedBrowser = null;
panel.remove();
+ // closeWindow might wait an arbitrary length of time if we're supposed
+ // to warn about closing the window, so we'll just stop the tab close
+ // timer here instead.
+ TelemetryStopwatch.finish("FX_TAB_CLOSE_TIME_MS", aTab);
+
if (aCloseWindow)
this._windowIsClosing = closeWindow(true, window.warnAboutClosingWindow);
]]>
</body>
</method>
<method name="_blurTab">
<parameter name="aTab"/>
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5024,16 +5024,25 @@
},
"FX_GESTURE_COMPRESS_SNAPSHOT_OF_PAGE": {
"expires_in_version": "50",
"kind": "exponential",
"high": 1000,
"n_buckets": 30,
"description": "Firefox: Time taken to kick off image compression of the canvas that will be used during swiping through history (ms)."
},
+ "FX_TAB_CLOSE_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 from the point of closing a tab to the browser element being removed from the DOM. (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"
},