Bug 1569004 - Convert dom.timeout.enable_budget_timer_throttling to static pref. r=njn

Converts dom.timeout.enable_budget_timer_throttling from varcache pref to static pref, removes entry from all.js, adds entry to StaticPrefList.yaml. Uses the all.js value and not the value declared in TimeoutManager.cpp. Since this removes the last varcache pref from TimeoutManager::Initialize(), I also removed the Initialize() function and its call in nsGlobalWindowInner.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2019-07-26 20:14:48 +00:00
parent c6f7b5dbfa
commit 05b0ade9f4
5 changed files with 8 additions and 27 deletions

View File

@ -34,9 +34,6 @@ LazyLogModule gTimeoutLog("Timeout");
static int32_t gRunningTimeoutDepth = 0;
#define DEFAULT_ENABLE_BUDGET_TIMEOUT_THROTTLING false
static bool gEnableBudgetTimeoutThrottling = false;
// static
const uint32_t TimeoutManager::InvalidFiringId = 0;
@ -447,13 +444,6 @@ TimeoutManager::~TimeoutManager() {
("TimeoutManager %p destroyed\n", this));
}
/* static */
void TimeoutManager::Initialize() {
Preferences::AddBoolVarCache(&gEnableBudgetTimeoutThrottling,
"dom.timeout.enable_budget_timer_throttling",
DEFAULT_ENABLE_BUDGET_TIMEOUT_THROTTLING);
}
uint32_t TimeoutManager::GetTimeoutId(Timeout::Reason aReason) {
switch (aReason) {
case Timeout::Reason::eIdleCallbackTimeout:
@ -1307,7 +1297,8 @@ void TimeoutManager::StartThrottlingTimeouts() {
MOZ_DIAGNOSTIC_ASSERT(!mThrottleTimeouts);
mThrottleTimeouts = true;
mThrottleTrackingTimeouts = true;
mBudgetThrottleTimeouts = gEnableBudgetTimeoutThrottling;
mBudgetThrottleTimeouts =
StaticPrefs::dom_timeout_enable_budget_timer_throttling();
mThrottleTimeoutsTimer = nullptr;
}

View File

@ -80,9 +80,6 @@ class TimeoutManager final {
// to the background or foreground.
void UpdateBackgroundState();
// Initialize TimeoutManager before the first time it is accessed.
static void Initialize();
// The document finished loading
void OnDocumentLoaded();
void StartThrottlingTimeouts();

View File

@ -907,16 +907,6 @@ nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter* aOuterWindow)
}
}
// We could have failed the first time through trying
// to create the entropy collector, so we should
// try to get one until we succeed.
static bool sFirstTime = true;
if (sFirstTime) {
sFirstTime = false;
TimeoutManager::Initialize();
}
if (gDumpFile == nullptr) {
nsAutoCString fname;
Preferences::GetCString("browser.dom.window.dump.file", fname);

View File

@ -1851,6 +1851,12 @@
value: 15000
mirror: always
# Turn on budget throttling by default.
- name: dom.timeout.enable_budget_timer_throttling
type: bool
value: true
mirror: always
# Should we defer timeouts and intervals while loading a page. Released
# on Idle or when the page is loaded.
- name: dom.timeout.defer_during_load

View File

@ -1083,9 +1083,6 @@ pref("dom.storage.client_validation", true);
pref("dom.send_after_paint_to_content", false);
// Turn on budget throttling by default
pref("dom.timeout.enable_budget_timer_throttling", true);
// Don't use new input types
pref("dom.experimental_forms", false);