Backed out changeset b88648a41ed2 (bug 1245891) for talos timeouts
authorWes Kocher <wkocher@mozilla.com>
Fri, 26 Feb 2016 12:29:03 -0800
changeset 322211 53bb059dd388065181e77f2a935dc680fad41b38
parent 322210 fce4115d2040062f75a6c7bb98a3ea0f6700d729
child 322212 a0f39313b05eeb3b890c3508e9530283febe654e
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1245891
milestone47.0a1
backs outb88648a41ed26abcc1a9184d6c583f60c600014b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset b88648a41ed2 (bug 1245891) for talos timeouts MozReview-Commit-ID: BxDPXC2rA4m
browser/components/sessionstore/StartupPerformance.jsm
testing/talos/talos/startup_test/sessionrestore/addon/SessionRestoreTalosTest.js
--- a/browser/components/sessionstore/StartupPerformance.jsm
+++ b/browser/components/sessionstore/StartupPerformance.jsm
@@ -18,24 +18,19 @@ XPCOMUtils.defineLazyModuleGetter(this, 
   "resource://gre/modules/Timer.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "clearTimeout",
   "resource://gre/modules/Timer.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
   "resource://gre/modules/Promise.jsm");
 
 const COLLECT_RESULTS_AFTER_MS = 10000;
 
-const OBSERVED_TOPICS = ["sessionstore-restoring-on-startup", "sessionstore-initiating-manual-restore"];
+const TOPICS = ["sessionstore-restoring-on-startup", "sessionstore-initiating-manual-restore"];
 
 this.StartupPerformance = {
-  /**
-   * Once we have finished restoring initial tabs, we broadcast on this topic.
-   */
-  RESTORED_TOPIC: "sessionstore-finished-restoring-initial-tabs",
-
   // Instant at which we have started restoration (notification "sessionstore-restoring-on-startup")
   _startTimeStamp: null,
 
   // Latest instant at which we have finished restoring a tab (DOM event "SSTabRestored")
   _latestRestoredTimeStamp: null,
 
   // A promise resolved once we have finished restoring all the startup tabs.
   _promiseFinished: null,
@@ -50,73 +45,62 @@ this.StartupPerformance = {
   _hasFired: false,
 
   // Statistics on the session we need to restore.
   _totalNumberOfEagerTabs: 0,
   _totalNumberOfTabs: 0,
   _totalNumberOfWindows: 0,
 
   init: function() {
-    for (let topic of OBSERVED_TOPICS) {
+    for (let topic of TOPICS) {
       Services.obs.addObserver(this, topic, false);
     }
   },
 
-  /**
-   * Return the timestamp at which we finished restoring the latest tab.
-   *
-   * This information is not really interesting until we have finished restoring
-   * tabs.
-   */
-  get latestRestoredTimeStamp() {
-    return this._latestRestoredTimeStamp;
-  },
-
   // Called when restoration starts.
   // Record the start timestamp, setup the timer and `this._promiseFinished`.
   // Behavior is unspecified if there was already an ongoing measure.
   _onRestorationStarts: function(isAutoRestore) {
-    this._latestRestoredTimeStamp = this._startTimeStamp = Date.now();
+    this._startTimeStamp = Date.now();
     this._totalNumberOfEagerTabs = 0;
     this._totalNumberOfTabs = 0;
     this._totalNumberOfWindows = 0;
 
     // While we may restore several sessions in a single run of the browser,
     // that's a very unusual case, and not really worth measuring, so let's
     // stop listening for further restorations.
 
-    for (let topic of OBSERVED_TOPICS) {
+    for (let topic of TOPICS) {
       Services.obs.removeObserver(this, topic);
     }
 
     Services.obs.addObserver(this, "sessionstore-single-window-restored", false);
     this._promiseFinished = new Promise(resolve => {
       this._resolveFinished = resolve;
     });
     this._promiseFinished.then(() => {
       try {
-        Services.obs.notifyObservers(null, this.RESTORED_TOPIC, "");
-
-        if (this._latestRestoredTimeStamp == this._startTimeStamp) {
+        if (!this._latestRestoredTimeStamp) {
           // Apparently, we haven't restored any tab.
           return;
         }
 
         // Once we are done restoring tabs, update Telemetry.
         let histogramName = isAutoRestore ?
           "FX_SESSION_RESTORE_AUTO_RESTORE_DURATION_UNTIL_EAGER_TABS_RESTORED_MS" :
           "FX_SESSION_RESTORE_MANUAL_RESTORE_DURATION_UNTIL_EAGER_TABS_RESTORED_MS";
         let histogram = Services.telemetry.getHistogramById(histogramName);
         let delta = this._latestRestoredTimeStamp - this._startTimeStamp;
         histogram.add(delta);
 
         Services.telemetry.getHistogramById("FX_SESSION_RESTORE_NUMBER_OF_EAGER_TABS_RESTORED").add(this._totalNumberOfEagerTabs);
         Services.telemetry.getHistogramById("FX_SESSION_RESTORE_NUMBER_OF_TABS_RESTORED").add(this._totalNumberOfTabs);
         Services.telemetry.getHistogramById("FX_SESSION_RESTORE_NUMBER_OF_WINDOWS_RESTORED").add(this._totalNumberOfWindows);
 
+
         // Reset
         this._startTimeStamp = null;
      } catch (ex) {
         console.error("StartupPerformance: error after resolving promise", ex);
       }
     });
   },
 
--- a/testing/talos/talos/startup_test/sessionrestore/addon/SessionRestoreTalosTest.js
+++ b/testing/talos/talos/startup_test/sessionrestore/addon/SessionRestoreTalosTest.js
@@ -11,21 +11,20 @@ const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
   "resource://gre/modules/Services.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
   "resource://gre/modules/Timer.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "StartupPerformance",
-  "resource://gre/modules/sessionstore/StartupPerformance.jsm");
 
 // Observer Service topics.
 const STARTUP_TOPIC = "profile-after-change";
+const RESTORED_TOPIC = "sessionstore-windows-restored";
 
 // Process Message Manager topics.
 const MSG_REQUEST = "session-restore-test?duration";
 const MSG_PROVIDE = "session-restore-test:duration";
 
 function nsSessionRestoreTalosTest() {}
 
 nsSessionRestoreTalosTest.prototype = {
@@ -41,39 +40,39 @@ nsSessionRestoreTalosTest.prototype = {
   //////////////////////////////////////////////////////////////////////////////
   //// nsIObserver
 
   observe: function DS_observe(aSubject, aTopic, aData) {
     switch (aTopic) {
       case STARTUP_TOPIC:
         this.init();
         break;
-      case StartupPerformance.RESTORED_TOPIC:
+      case RESTORED_TOPIC:
         this.onRestored();
         break;
       default:
         throw new Error(`Unknown topic ${aTopic}`);
     }
   },
 
   /**
    * Perform initialization on profile-after-change.
    */
   init: function() {
-    Services.obs.addObserver(this, StartupPerformance.RESTORED_TOPIC, false);
+    Services.obs.addObserver(this, RESTORED_TOPIC, false);
   },
 
   /**
    * Session Restore is complete, hurray.
    */
   onRestored: function() {
     setTimeout(function() {
-      // `StartupPerformance.latestRestoredTimeStamp` actually becomes available only on the next tick.
+      // `sessionRestored` actually becomes available only on the next tick.
       let startup_info = Services.startup.getStartupInfo();
-      let duration = StartupPerformance.latestRestoredTimeStamp - startup_info.sessionRestoreInit;
+      let duration = startup_info.sessionRestored - startup_info.sessionRestoreInit;
 
       // Broadcast startup duration information immediately, in case the talos
       // page is already loaded.
       Services.ppmm.broadcastAsyncMessage(MSG_PROVIDE, {duration});
 
       // Now, in case the talos page isn't loaded yet, prepare to respond if it
       // requestions the duration information.
       Services.ppmm.addMessageListener(MSG_REQUEST, function listener() {