B2G/gecko/toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js
/**
 * The Tile Manager!
 *
 * @param appendTile The function the tile manager should call in order to
 * "display" a tile (e.g. append it to the DOM).  The argument to this
 * function is a TileManager.Tile object.
 * @param removeTile The function the tile manager should call in order to
 * "undisplay" a tile (e.g. remove it from the DOM).  The argument to this
 * function is a TileManager.Tile object.
 * @param fakeWidth The width of the widest possible visible rectangle, e.g.
 * the width of the screen.  This is used in setting the zoomLevel.
 */
The Tile Manager.
@param appendTile The function the tile manager should call in order to
"display" a tile .  The argument to this
function is a TileManager.Tile object.
@param removeTile The function the tile manager should call in order to
"undisplay" a tile .  The argument to this
function is a TileManager.Tile object.
@param fakeWidth The width of the widest possible visible rectangle, e.g.
the width of the screen.  This is used in setting the zoomLevel.
The Tile Manager . @param appendTile The function the tile manager should call in order to " display " a tile . The argument to this function is a TileManager . Tile object . @param removeTile The function the tile manager should call in order to " undisplay " a tile . The argument to this function is a TileManager . Tile object . @param fakeWidth The width of the widest possible visible rectangle e . g . the width of the screen . This is used in setting the zoomLevel .
function TileManager(appendTile, removeTile, browserView) {
  this._browserView = browserView;
  this._appendTile = appendTile;
  this._removeTile = removeTile;
  let self = this;
  this._tileCache = new TileManager.TileCache(function(tile) { self._removeTileSafe(tile); },
                                              -1, -1, 110);
  this._criticalRect = null;
  this._browser = null;
  this._pageLoadResizerTimeout = 0;
  this._idleTileCrawlerTimeout = 0;
  this._crawler = null;
  this._pageLoadMaxRight = 0;
  this._pageLoadMaxBottom = 0;
  this._needToPanToTop = false;
}
function TileManager ( appendTile , removeTile , browserView ) { this . _browserView = browserView ; this . _appendTile = appendTile ; this . _removeTile = removeTile ; let self = this ; this . _tileCache = new TileManager . TileCache ( function ( tile ) { self . _removeTileSafe ( tile ) ; } , - 1 , - 1 , 110 ) ; this . _criticalRect = null ; this . _browser = null ; this . _pageLoadResizerTimeout = 0 ; this . _idleTileCrawlerTimeout = 0 ; this . _crawler = null ; this . _pageLoadMaxRight = 0 ; this . _pageLoadMaxBottom = 0 ; this . _needToPanToTop = false ; }
The Tile Manager!
The Tile Manager!
// backref to the BrowserView object that owns us // callbacks to append / remove a tile to / from the parent // tile cache holds tile objects and pools them under a given capacity // Rectangle within the viewport that is visible to the user.  It is "critical" // in the sense that it must be rendered as soon as it becomes dirty // Current <browser> DOM element, holding the content we wish to render. // This is null when no browser is attached // if we have an outstanding paint timeout, its value is stored here // for cancelling when we end page loads //this._drawTimeout = 0; // timeout of the non-visible-tiles-crawler to cache renders from the browser // object that keeps state on our current lazyload crawl // the max right coordinate we've seen from paint events // while we were loading a page.  If we see something that's bigger than // our width, we'll trigger a page zoom. // Tells us to pan to top before first draw