B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * save state delayed by N ms
   * marks window as dirty (i.e. data update can't be skipped)
   * @param aWindow
   *        Window reference
   * @param aDelay
   *        Milliseconds to delay
   */
save state delayed by N ms
marks window as dirty
@param aWindow
Window reference
@param aDelay
Milliseconds to delay
save state delayed by N ms marks window as dirty @param aWindow Window reference @param aDelay Milliseconds to delay
function ssi_saveStateDelayed(aWindow, aDelay) {
    if (aWindow) {
      this._dirtyWindows[aWindow.__SSi] = true;
    }
    if (!this._saveTimer && !this._inPrivateBrowsing) {
      var minimalDelay = this._lastSaveTime + this._interval - Date.now();
      aDelay = Math.max(minimalDelay, aDelay || 2000);
      if (aDelay > 0) {
        this._saveTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
        this._saveTimer.init(this, aDelay, Ci.nsITimer.TYPE_ONE_SHOT);
      }
      else {
        this.saveState();
      }
    }
  }
function ssi_saveStateDelayed ( aWindow , aDelay ) { if ( aWindow ) { this . _dirtyWindows [ aWindow . __SSi ] = true ; } if ( ! this . _saveTimer && ! this . _inPrivateBrowsing ) { var minimalDelay = this . _lastSaveTime + this . _interval - Date . now ( ) ; aDelay = Math . max ( minimalDelay , aDelay || 2000 ) ; if ( aDelay > 0 ) { this . _saveTimer = Cc [ "@mozilla.org/timer;1" ] . createInstance ( Ci . nsITimer ) ; this . _saveTimer . init ( this , aDelay , Ci . nsITimer . TYPE_ONE_SHOT ) ; } else { this . saveState ( ) ; } } }
save state delayed by N ms
 marks window as dirty (i.e.
save state delayed by N ms marks window as dirty ( i . e .
// interval until the next disk operation is allowed // if we have to wait, set a timer, otherwise saveState directly