Bug 1244684 - Make FX_TAB_SWITCH_TOTAL_MS work for non-e10s in an OMTC world. r?mstange draft
authorMike Conley <mconley@mozilla.com>
Tue, 23 Feb 2016 12:12:01 -0500
changeset 333402 78bd7dc54b52fdf954387033588614de0f7a9f43
parent 332881 789a12291942763bc1e3a89f97e0b82dc1c9d00b
child 514734 c9c3f93aaac56f0a37d4e3b248ce53d599ef0207
push id11353
push usermconley@mozilla.com
push dateTue, 23 Feb 2016 17:12:23 +0000
reviewersmstange
bugs1244684
milestone47.0a1
Bug 1244684 - Make FX_TAB_SWITCH_TOTAL_MS work for non-e10s in an OMTC world. r?mstange MozReview-Commit-ID: VKFKi1u6az
browser/base/content/tabbrowser.xml
--- 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;