Bug 1562305 - Make browser.cache.disk.metadata_memory_limit a static pref. r=michal

Differential Revision: https://phabricator.services.mozilla.com/D37179

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-07-11 04:40:17 +00:00
Родитель dcb65203e0
Коммит 0912179ccc
4 изменённых файлов: 9 добавлений и 11 удалений

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

@ -726,6 +726,14 @@ VARCACHE_PREF(
RelaxedAtomicBool, true
)
// Limit of recent metadata we keep in memory for faster access, in KB.
VARCACHE_PREF(
Live,
"browser.cache.disk.metadata_memory_limit",
browser_cache_disk_metadata_memory_limit,
RelaxedAtomicUint32, 250 // 0.25 MB
)
// Whether Content Blocking Third-Party Cookies UI has been enabled.
VARCACHE_PREF(
Live,

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

@ -62,8 +62,6 @@ pref("browser.cache.disk.max_priority_chunks_memory_usage", 40960);
pref("browser.cache.disk_cache_ssl", true);
// 0 = once-per-session, 1 = each-time, 2 = never, 3 = when-appropriate/automatically
pref("browser.cache.check_doc_frequency", 3);
// Limit of recent metadata we keep in memory for faster access, in Kb
pref("browser.cache.disk.metadata_memory_limit", 250); // 0.25 MB
// The number of chunks we preload ahead of read. One chunk has currently 256kB.
pref("browser.cache.disk.preload_chunk_count", 4); // 1 MB of read ahead
// The half life used to re-compute cache entries frecency in hours.

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

@ -26,9 +26,6 @@ StaticRefPtr<CacheObserver> CacheObserver::sSelf;
static float const kDefaultHalfLifeHours = 24.0F; // 24 hours
float CacheObserver::sHalfLifeHours = kDefaultHalfLifeHours;
static uint32_t const kDefaultMetadataMemoryLimit = 250; // 0.25 MB
uint32_t CacheObserver::sMetadataMemoryLimit = kDefaultMetadataMemoryLimit;
static int32_t const kDefaultMemoryCacheCapacity = -1; // autodetect
int32_t CacheObserver::sMemoryCacheCapacity = kDefaultMemoryCacheCapacity;
// Cache of the calculated memory capacity based on the system memory size in KB
@ -140,10 +137,6 @@ nsresult CacheObserver::Shutdown() {
}
void CacheObserver::AttachToPreferences() {
mozilla::Preferences::AddUintVarCache(
&sMetadataMemoryLimit, "browser.cache.disk.metadata_memory_limit",
kDefaultMetadataMemoryLimit);
mozilla::Preferences::AddAtomicUintVarCache(&sDiskCacheCapacity,
"browser.cache.disk.capacity",
kDefaultDiskCacheCapacity);

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

@ -34,7 +34,7 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
}
static uint32_t MetadataMemoryLimit() // result in kilobytes.
{
return sMetadataMemoryLimit;
return StaticPrefs::browser_cache_disk_metadata_memory_limit();
}
static uint32_t MemoryCacheCapacity(); // result in kilobytes.
static uint32_t DiskCacheCapacity() // result in kilobytes.
@ -103,7 +103,6 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
void StoreCacheAmountWritten();
void AttachToPreferences();
static uint32_t sMetadataMemoryLimit;
static int32_t sMemoryCacheCapacity;
static int32_t sAutoMemoryCacheCapacity;
static Atomic<uint32_t, Relaxed> sDiskCacheCapacity;