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

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-07-11 04:38:36 +00:00
Родитель 0d47e90e70
Коммит 0001b36344
4 изменённых файлов: 15 добавлений и 17 удалений

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

@ -823,6 +823,16 @@ VARCACHE_PREF(
RelaxedAtomicUint32, 40 * 1024
)
// Number of seconds the cache spends writing pending data and closing files
// after shutdown has been signalled. Past that time data is not written and
// files are left open for the OS to clean up.
VARCACHE_PREF(
Live,
"browser.cache.max_shutdown_io_lag",
browser_cache_max_shutdown_io_lag,
RelaxedAtomicUint32, 2
)
// Whether Content Blocking Third-Party Cookies UI has been enabled.
VARCACHE_PREF(
Live,

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

@ -37,11 +37,6 @@ pref("browser.cache.check_doc_frequency", 3);
// The half life used to re-compute cache entries frecency in hours.
pref("browser.cache.frecency_half_life_hours", 6);
// Number of seconds the cache spends writting pending data and closing files
// after the shutdown has been signalled. Past that time data are never written
// and files are left open given up to the OS to do the cleanup.
pref("browser.cache.max_shutdown_io_lag", 2);
// AppCache over insecure connection is disabled by default
pref("browser.cache.offline.insecure.enable", false);

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

@ -45,10 +45,6 @@ bool CacheObserver::sCacheFSReported = kDefaultCacheFSReported;
static bool kDefaultHashStatsReported = false;
bool CacheObserver::sHashStatsReported = kDefaultHashStatsReported;
static uint32_t const kDefaultMaxShutdownIOLag = 2; // seconds
Atomic<uint32_t, Relaxed> CacheObserver::sMaxShutdownIOLag(
kDefaultMaxShutdownIOLag);
Atomic<PRIntervalTime> CacheObserver::sShutdownDemandedTime(
PR_INTERVAL_NO_TIMEOUT);
@ -122,10 +118,6 @@ void CacheObserver::AttachToPreferences() {
"privacy.clearOnShutdown.cache",
kDefaultClearCacheOnShutdown);
mozilla::Preferences::AddAtomicUintVarCache(
&sMaxShutdownIOLag, "browser.cache.max_shutdown_io_lag",
kDefaultMaxShutdownIOLag);
mozilla::Preferences::AddAtomicUintVarCache(
&sTelemetryReportID, "browser.cache.disk.telemetry_report_ID",
kDefaultTelemetryReportID);
@ -375,12 +367,12 @@ bool CacheObserver::IsPastShutdownIOLag() {
#endif
if (sShutdownDemandedTime == PR_INTERVAL_NO_TIMEOUT ||
sMaxShutdownIOLag == UINT32_MAX) {
MaxShutdownIOLag() == UINT32_MAX) {
return false;
}
static const PRIntervalTime kMaxShutdownIOLag =
PR_SecondsToInterval(sMaxShutdownIOLag);
PR_SecondsToInterval(MaxShutdownIOLag());
if ((PR_IntervalNow() - sShutdownDemandedTime) > kMaxShutdownIOLag) {
return true;

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

@ -91,7 +91,9 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
static bool EntryIsTooBig(int64_t aSize, bool aUsingDisk);
static uint32_t MaxShutdownIOLag() { return sMaxShutdownIOLag; }
static uint32_t MaxShutdownIOLag() {
return StaticPrefs::browser_cache_max_shutdown_io_lag();
}
static bool IsPastShutdownIOLag();
static bool ShuttingDown() {
@ -115,7 +117,6 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
static bool sClearCacheOnShutdown;
static bool sCacheFSReported;
static bool sHashStatsReported;
static Atomic<uint32_t, Relaxed> sMaxShutdownIOLag;
static Atomic<PRIntervalTime> sShutdownDemandedTime;
static Atomic<uint32_t, Relaxed> sTelemetryReportID;
static Atomic<uint32_t, Relaxed> sCacheAmountWritten;