Bug 1244684 - Make FX_TAB_SWITCH_TOTAL_MS work for non-e10s in an OMTC world. r?mstange
MozReview-Commit-ID: VKFKi1u6az
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1021,21 +1021,26 @@
<body>
<![CDATA[
var newBrowser = this.getBrowserAtIndex(this.tabContainer.selectedIndex);
if (this.mCurrentBrowser == newBrowser && !aForceUpdate)
return;
if (!aForceUpdate) {
TelemetryStopwatch.start("FX_TAB_SWITCH_UPDATE_MS");
- if (!Services.appinfo.browserTabsRemoteAutostart) {
- // old way of measuring tab paint which is not
- // valid with e10s.
- window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
- .beginTabSwitch();
+ if (!gMultiProcessBrowser) {
+ // old way of measuring tab paint which is not valid with e10s.
+ // Waiting until the next MozAfterPaint ensures that we capture
+ // the time it takes to paint, upload the textures to the compositor,
+ // and then composite.
+ TelemetryStopwatch.start("FX_TAB_SWITCH_TOTAL_MS");
+ window.addEventListener("MozAfterPaint", function onMozAfterPaint() {
+ TelemetryStopwatch.finish("FX_TAB_SWITCH_TOTAL_MS");
+ window.removeEventListener("MozAfterPaint", onMozAfterPaint);
+ });
}
}
var oldTab = this.mCurrentTab;
// Preview mode should not reset the owner
if (!this._previewMode && !oldTab.selected)
oldTab.owner = null;