Bug 1562305 - Make browser.cache.memory.max_entry_size a static pref. r=michal

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-07-11 04:12:59 +00:00
Родитель 3a80622aef
Коммит eb1b20a058
4 изменённых файлов: 11 добавлений и 13 удалений

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

@ -793,6 +793,15 @@ VARCACHE_PREF(
RelaxedAtomicUint32, 50 * 1024 // 50 MB
)
// Max-size (in KB) for entries in memory cache. Set to -1 for no limit.
// (Note: entries bigger than than 90% of the mem-cache are never cached.)
VARCACHE_PREF(
Live,
"browser.cache.memory.max_entry_size",
browser_cache_memory_max_entry_size,
RelaxedAtomicInt32, 5 * 1024
)
// Whether Content Blocking Third-Party Cookies UI has been enabled.
VARCACHE_PREF(
Live,

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

@ -30,9 +30,6 @@ pref("browser.bookmarks.max_backups", 5);
// Size (in KB) explicitly set by the user. Used when smart_size.enabled == false
pref("browser.cache.disk.capacity", 256000);
// Max-size (in KB) for entries in memory cache. Set to -1 for no limit.
// (Note: entries bigger than than 90% of the mem-cache are never cached)
pref("browser.cache.memory.max_entry_size", 5120);
// Memory limit (in kB) for new cache data not yet written to disk. Writes to
// the cache are buffered and written to disk on background with low priority.
// With a slow persistent storage these buffers may grow when data is coming

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

@ -33,9 +33,6 @@ static uint32_t const kDefaultDiskCacheCapacity = 250 * 1024; // 250 MB
Atomic<uint32_t, Relaxed> CacheObserver::sDiskCacheCapacity(
kDefaultDiskCacheCapacity);
static int32_t const kDefaultMaxMemoryEntrySize = 4 * 1024; // 4 MB
int32_t CacheObserver::sMaxMemoryEntrySize = kDefaultMaxMemoryEntrySize;
static uint32_t const kDefaultMaxDiskChunksMemoryUsage = 40 * 1024; // 40MB
uint32_t CacheObserver::sMaxDiskChunksMemoryUsage =
kDefaultMaxDiskChunksMemoryUsage;
@ -121,10 +118,6 @@ void CacheObserver::AttachToPreferences() {
"browser.cache.disk.capacity",
kDefaultDiskCacheCapacity);
mozilla::Preferences::AddIntVarCache(&sMaxMemoryEntrySize,
"browser.cache.memory.max_entry_size",
kDefaultMaxMemoryEntrySize);
mozilla::Preferences::AddUintVarCache(
&sMaxDiskChunksMemoryUsage, "browser.cache.disk.max_chunks_memory_usage",
kDefaultMaxDiskChunksMemoryUsage);
@ -380,7 +373,7 @@ nsresult Run(OriginAttributes& aOa) {
bool CacheObserver::EntryIsTooBig(int64_t aSize, bool aUsingDisk) {
// If custom limit is set, check it.
int64_t preferredLimit =
aUsingDisk ? MaxDiskEntrySize() : sMaxMemoryEntrySize;
aUsingDisk ? MaxDiskEntrySize() : MaxMemoryEntrySize();
// do not convert to bytes when the limit is -1, which means no limit
if (preferredLimit > 0) {

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

@ -58,7 +58,7 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
}
static uint32_t MaxMemoryEntrySize() // result in kilobytes.
{
return sMaxMemoryEntrySize;
return StaticPrefs::browser_cache_memory_max_entry_size();
}
static uint32_t MaxDiskEntrySize() // result in kilobytes.
{
@ -109,7 +109,6 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
static int32_t sAutoMemoryCacheCapacity;
static Atomic<uint32_t, Relaxed> sDiskCacheCapacity;
static int32_t sMaxMemoryEntrySize;
static uint32_t sMaxDiskChunksMemoryUsage;
static uint32_t sMaxDiskPriorityChunksMemoryUsage;
static uint32_t sCompressionLevel;