mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786086 - Make the new default cache size display properly. r=michal
This commit is contained in:
parent
5b96566402
commit
d158d44f4b
34
netwerk/cache/nsCacheService.cpp
vendored
34
netwerk/cache/nsCacheService.cpp
vendored
@ -173,8 +173,9 @@ public:
|
|||||||
uint32_t currentSize,
|
uint32_t currentSize,
|
||||||
bool shouldUseOldMaxSmartSize);
|
bool shouldUseOldMaxSmartSize);
|
||||||
|
|
||||||
private:
|
|
||||||
bool PermittedToSmartSize(nsIPrefBranch*, bool firstRun);
|
bool PermittedToSmartSize(nsIPrefBranch*, bool firstRun);
|
||||||
|
|
||||||
|
private:
|
||||||
bool mHaveProfile;
|
bool mHaveProfile;
|
||||||
|
|
||||||
bool mDiskCacheEnabled;
|
bool mDiskCacheEnabled;
|
||||||
@ -1595,28 +1596,27 @@ public:
|
|||||||
if (!nsCacheService::gService || !nsCacheService::gService->mObserver)
|
if (!nsCacheService::gService || !nsCacheService::gService->mObserver)
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
nsDisableOldMaxSmartSizePrefEvent::DisableOldMaxSmartSizePref(true);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DisableOldMaxSmartSizePref(bool async)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
return;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = branch->SetBoolPref(DISK_CACHE_USE_OLD_MAX_SMART_SIZE_PREF, false);
|
nsresult rv = branch->SetBoolPref(DISK_CACHE_USE_OLD_MAX_SMART_SIZE_PREF, false);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("Failed to disable old max smart size");
|
NS_WARNING("Failed to disable old max smart size");
|
||||||
return;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (async) {
|
nsCacheService::SetDiskSmartSize();
|
||||||
nsCacheService::SetDiskSmartSize();
|
|
||||||
} else {
|
if (nsCacheService::gService->mObserver->PermittedToSmartSize(branch, false)) {
|
||||||
nsCacheService::gService->SetDiskSmartSize_Locked();
|
rv = branch->SetIntPref(DISK_CACHE_CAPACITY_PREF, MAX_CACHE_SIZE);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
NS_WARNING("Failed to set cache capacity pref");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1630,11 +1630,9 @@ nsCacheService::MarkStartingFresh()
|
|||||||
|
|
||||||
gService->mObserver->SetUseNewMaxSmartSize(true);
|
gService->mObserver->SetUseNewMaxSmartSize(true);
|
||||||
|
|
||||||
if (NS_IsMainThread()) {
|
// We always dispatch an event here because we don't want to deal with lock
|
||||||
nsDisableOldMaxSmartSizePrefEvent::DisableOldMaxSmartSizePref(false);
|
// reentrance issues.
|
||||||
} else {
|
NS_DispatchToMainThread(new nsDisableOldMaxSmartSizePrefEvent());
|
||||||
NS_DispatchToMainThread(new nsDisableOldMaxSmartSizePrefEvent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
Loading…
Reference in New Issue
Block a user