зеркало из https://github.com/mozilla/gecko-dev.git
Bug 522514: Make tile capacity a preference [r=stechz]
This commit is contained in:
Родитель
50b578a4d5
Коммит
91e5b46303
|
@ -75,6 +75,13 @@ pref("browser.cache.disk.capacity", 0); // kilobytes
|
|||
pref("browser.cache.memory.enable", true);
|
||||
pref("browser.cache.memory.capacity", 1024); // kilobytes
|
||||
|
||||
/* tile cache prefs */
|
||||
#ifdef WINCE
|
||||
pref("tile.cache.size", 15); // tiles
|
||||
#else
|
||||
pref("tile.cache.size", 30); // tiles
|
||||
#endif
|
||||
|
||||
/* image cache prefs */
|
||||
pref("image.cache.size", 1048576); // bytes
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ const kBrowserViewZoomLevelMin = 0.2;
|
|||
const kBrowserViewZoomLevelMax = 4.0;
|
||||
const kBrowserViewZoomLevelPrecision = 10000;
|
||||
const kBrowserViewPrefetchBeginIdleWait = 1; // seconds
|
||||
|
||||
const kBrowserViewCacheSize = 15;
|
||||
|
||||
/**
|
||||
* A BrowserView maintains state of the viewport (browser, zoom level,
|
||||
|
@ -232,7 +232,12 @@ BrowserView.prototype = {
|
|||
this._browserViewportState = null;
|
||||
this._contentWindow = null;
|
||||
this._renderMode = 0;
|
||||
this._tileManager = new TileManager(this._appendTile, this._removeTile, this);
|
||||
|
||||
let cacheSize = kBrowserViewCacheSize;
|
||||
try {
|
||||
cacheSize = gPrefService.getIntPref("tile.cache.size");
|
||||
} catch(e) {}
|
||||
this._tileManager = new TileManager(this._appendTile, this._removeTile, this, cacheSize);
|
||||
this._visibleRectFactory = visibleRectFactory;
|
||||
|
||||
this._idleServiceObserver = new BrowserView.IdleServiceObserver(this);
|
||||
|
|
|
@ -98,8 +98,6 @@ const kTileWidth = Math.pow(2, kTileExponentWidth); // 2^9 = 512
|
|||
const kTileHeight = Math.pow(2, kTileExponentHeight); // 2^9 = 512
|
||||
const kTileCrawlTimeCap = 100; // millis
|
||||
const kTileCrawlComeAgain = 0; // millis
|
||||
const kInitialCacheCapacity = 15;
|
||||
|
||||
|
||||
/**
|
||||
* The Tile Manager!
|
||||
|
@ -113,7 +111,7 @@ const kInitialCacheCapacity = 15;
|
|||
* @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) {
|
||||
function TileManager(appendTile, removeTile, browserView, cacheSize) {
|
||||
/* backref to the BrowserView object that owns us */
|
||||
this._browserView = browserView;
|
||||
|
||||
|
@ -124,7 +122,7 @@ function TileManager(appendTile, removeTile, browserView) {
|
|||
/* tile cache holds tile objects and pools them under a given capacity */
|
||||
let self = this;
|
||||
this._tileCache = new TileManager.TileCache(function(tile) { self._removeTileSafe(tile); },
|
||||
-1, -1, kInitialCacheCapacity);
|
||||
-1, -1, cacheSize);
|
||||
|
||||
/* 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, and tiles
|
||||
|
|
Загрузка…
Ссылка в новой задаче