mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Use 1 GB cache size while we wait for the smart size event. r=jst, a=beta7
This commit is contained in:
parent
bb69c203d1
commit
3fdec5a382
17
netwerk/cache/nsCacheService.cpp
vendored
17
netwerk/cache/nsCacheService.cpp
vendored
@ -606,6 +606,9 @@ nsCacheProfilePrefObserver::PermittedToSmartSize(nsIPrefBranch* branch, PRBool
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Set manual setting to MAX cache size as starting val for any
|
||||
// adjustment by user: (bug 559942 comment 65)
|
||||
branch->SetIntPref(DISK_CACHE_CAPACITY_PREF, MAX_CACHE_SIZE);
|
||||
}
|
||||
PRBool smartSizeEnabled;
|
||||
rv = branch->GetBoolPref(DISK_CACHE_SMART_SIZE_ENABLED_PREF,
|
||||
@ -680,17 +683,21 @@ nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch)
|
||||
if (NS_FAILED(rv))
|
||||
firstSmartSizeRun = PR_FALSE;
|
||||
if (PermittedToSmartSize(branch, firstSmartSizeRun)) {
|
||||
// Prevent unnecessary eviction before smart size event returns
|
||||
// Avoid evictions: use previous cache size while we wait for smart
|
||||
// size event to update mDiskCacheCapacity
|
||||
if (!firstSmartSizeRun) {
|
||||
PRInt32 oldSmartSize;
|
||||
rv = branch->GetIntPref(DISK_CACHE_SMART_SIZE_PREF,
|
||||
&oldSmartSize);
|
||||
mDiskCacheCapacity = oldSmartSize;
|
||||
} else {
|
||||
rv = branch->SetIntPref(DISK_CACHE_CAPACITY_PREF,
|
||||
MAX_CACHE_SIZE);
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Failed setting capacity pref");
|
||||
PRInt32 oldCapacity;
|
||||
rv = branch->GetIntPref(DISK_CACHE_CAPACITY_PREF, &oldCapacity);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mDiskCacheCapacity = oldCapacity;
|
||||
} else {
|
||||
mDiskCacheCapacity = DEFAULT_CACHE_SIZE;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new nsGetSmartSizeEvent(!!firstSmartSizeRun);
|
||||
|
Loading…
Reference in New Issue
Block a user