B2G/gecko/browser/components/tabview/tabitems.js
// Should only be called by startHeartbeat and resumePainting.
Should only be called by startHeartbeat and resumePainting.
Should only be called by startHeartbeat and resumePainting .
function TabItems__checkHeartbeat() {
    this._heartbeat = null;
    if (this.isPaintingPaused())
      return;
    if (!UI.isIdle()) {
      this.startHeartbeat();
      return;
    }
    let accumTime = 0;
    let items = this._tabsWaitingForUpdate.getItems();
    while (accumTime < this._maxTimeForUpdating && items.length) {
      let updateBegin = Date.now();
      this._update(items.pop());
      let updateEnd = Date.now();
      let deltaTime = updateEnd - updateBegin;
      accumTime += deltaTime;
    }
    if (this._tabsWaitingForUpdate.hasItems())
      this.startHeartbeat();
  }
function TabItems__checkHeartbeat ( ) { this . _heartbeat = null ; if ( this . isPaintingPaused ( ) ) return ; if ( ! UI . isIdle ( ) ) { this . startHeartbeat ( ) ; return ; } let accumTime = 0 ; let items = this . _tabsWaitingForUpdate . getItems ( ) ; while ( accumTime < this . _maxTimeForUpdating && items . length ) { let updateBegin = Date . now ( ) ; this . _update ( items . pop ( ) ) ; let updateEnd = Date . now ( ) ; let deltaTime = updateEnd - updateBegin ; accumTime += deltaTime ; } if ( this . _tabsWaitingForUpdate . hasItems ( ) ) this . startHeartbeat ( ) ; }
Should only be called by startHeartbeat and resumePainting.
Should only be called by startHeartbeat and resumePainting .
// restart the heartbeat to update all waiting tabs once the UI becomes idle // Do as many updates as we can fit into a "perceived" amount // of time, which is tunable. // Maintain a simple average of time for each tabitem update // We can use this as a base by which to delay things like // tab zooming, so there aren't any hitches.