Bug 539481 - tile.cache.size default should be set every time Fennec loads [r=dougt r=stechz]

This commit is contained in:
Mark Finkle 2010-01-14 16:08:40 -05:00
Родитель 8b4893ea8b
Коммит 5a8131dc7a
2 изменённых файлов: 55 добавлений и 63 удалений

Просмотреть файл

@ -47,7 +47,7 @@ const kBrowserFormZoomLevelMax = 2.0;
const kBrowserViewZoomLevelPrecision = 10000;
const kBrowserViewPrefetchBeginIdleWait = 1; // seconds
const kBrowserViewPrefetchBeginIdleWaitLoading = 10; // seconds
const kBrowserViewCacheSize = 15;
const kBrowserViewCacheSize = 6;
/**
* A BrowserView maintains state of the viewport (browser, zoom level,
@ -244,11 +244,27 @@ BrowserView.prototype = {
let cacheSize = kBrowserViewCacheSize;
try {
cacheSize = gPrefService.getIntPref("tile.cache.size");
// XXX cacheSize still can be -1 even though new profile sets it to a positive value
if (cacheSize == -1)
cacheSize = kBrowserViewCacheSize;
} catch(e) {}
if (cacheSize == -1) {
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
let device = sysInfo.get("device");
switch (device) {
#ifdef MOZ_PLATFORM_HILDON
case "Nokia N900":
cacheSize = 26;
break;
case "Nokia N8xx":
// N8xx has half the memory of N900 and crashes with higher numbers
cacheSize = 10;
break;
#endif
default:
// Use a minimum number of tiles sice we don't know the device
cacheSize = 6;
}
}
this._tileManager = new TileManager(this._appendTile, this._removeTile, this, cacheSize);
this._visibleRectFactory = visibleRectFactory;
@ -894,4 +910,3 @@ BrowserView.IdleServiceObserver.prototype = {
bv._tileManager.setPrefetch(this._idle && !this._paused);
}
};

Просмотреть файл

@ -647,29 +647,6 @@ var Browser = {
this.setPluginState(false);
}
#endif
// set up the cache size
let cacheSize = -1;
try {
cacheSize = gPrefService.getIntPref("tile.cache.size");
} catch(e) {}
if (cacheSize == -1) {
switch (device) {
#ifdef MOZ_PLATFORM_HILDON
case "Nokia N900":
cacheSize = 26;
break;
case "Nokia N8xx":
// N8xx has half the memory of N900 and crashes with higher numbers
cacheSize = 10;
break;
#endif
default:
// Use a minimum number of tiles sice we don't know the device
cacheSize = 6;
}
gPrefService.setIntPref("tile.cache.size", cacheSize);
}
},
get browsers() {