author | kriswright <kwright@mozilla.com> |
Fri, 26 Jul 2019 20:06:08 +0000 | |
changeset 485179 | 3d7f9cba78a7e60b287058e6d25e6818999ac0d9 |
parent 485178 | 89aacbb2f52f8905045c0aba8b21cbd9e8dc3d31 |
child 485180 | ba7879d877738e0d676cc6504bab2e4c7d581f03 |
push id | 91160 |
push user | kwright@mozilla.com |
push date | Mon, 29 Jul 2019 17:51:51 +0000 |
treeherder | autoland@0a9a0b8b35fa [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | njn |
bugs | 1569004 |
milestone | 70.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/TimeoutManager.cpp +++ b/dom/base/TimeoutManager.cpp @@ -29,21 +29,19 @@ using namespace mozilla; using namespace mozilla::dom; LazyLogModule gTimeoutLog("Timeout"); static int32_t gRunningTimeoutDepth = 0; -#define DEFAULT_BACKGROUND_THROTTLING_MAX_BUDGET 50 // 50ms #define DEFAULT_FOREGROUND_THROTTLING_MAX_BUDGET -1 // infinite #define DEFAULT_BUDGET_THROTTLING_MAX_DELAY 15000 // 15s #define DEFAULT_ENABLE_BUDGET_TIMEOUT_THROTTLING false -static int32_t gBackgroundThrottlingMaxBudget = 0; static int32_t gForegroundThrottlingMaxBudget = 0; static int32_t gBudgetThrottlingMaxDelay = 0; static bool gEnableBudgetTimeoutThrottling = false; // static const uint32_t TimeoutManager::InvalidFiringId = 0; namespace { @@ -66,18 +64,20 @@ double GetRegenerationFactor(bool aIsBac TimeDuration GetMaxBudget(bool aIsBackground) { // Lookup function for "dom.timeout.{background, // foreground}_throttling_max_budget". // Returns how high a budget can be regenerated before being // clamped. If this value is less or equal to zero, // TimeDuration::Forever() is implied. - int32_t maxBudget = aIsBackground ? gBackgroundThrottlingMaxBudget - : gForegroundThrottlingMaxBudget; + int32_t maxBudget = + aIsBackground + ? StaticPrefs::dom_timeout_background_throttling_max_budget() + : gForegroundThrottlingMaxBudget; return maxBudget > 0 ? TimeDuration::FromMilliseconds(maxBudget) : TimeDuration::Forever(); } TimeDuration GetMinBudget(bool aIsBackground) { // The minimum budget is computed by looking up the maximum allowed // delay and computing how long time it would take to regenerate // that budget using the regeneration factor. This number is @@ -447,19 +447,16 @@ TimeoutManager::~TimeoutManager() { mIdleExecutor->Shutdown(); MOZ_LOG(gTimeoutLog, LogLevel::Debug, ("TimeoutManager %p destroyed\n", this)); } /* static */ void TimeoutManager::Initialize() { - Preferences::AddIntVarCache(&gBackgroundThrottlingMaxBudget, - "dom.timeout.background_throttling_max_budget", - DEFAULT_BACKGROUND_THROTTLING_MAX_BUDGET); Preferences::AddIntVarCache(&gForegroundThrottlingMaxBudget, "dom.timeout.foreground_throttling_max_budget", DEFAULT_FOREGROUND_THROTTLING_MAX_BUDGET); Preferences::AddIntVarCache(&gBudgetThrottlingMaxDelay, "dom.timeout.budget_throttling_max_delay", DEFAULT_BUDGET_THROTTLING_MAX_DELAY); Preferences::AddBoolVarCache(&gEnableBudgetTimeoutThrottling, "dom.timeout.enable_budget_timer_throttling", @@ -1277,18 +1274,19 @@ bool TimeoutManager::BudgetThrottlingEna // * It isn't active // * If it isn't using WebRTC // * If it hasn't got open WebSockets // * If it hasn't got active IndexedDB databases // Note that we allow both foreground and background to be // considered for budget throttling. What determines if they are if // budget throttling is enabled is the max budget. - if ((aIsBackground ? gBackgroundThrottlingMaxBudget - : gForegroundThrottlingMaxBudget) < 0) { + if ((aIsBackground + ? StaticPrefs::dom_timeout_background_throttling_max_budget() + : gForegroundThrottlingMaxBudget) < 0) { return false; } if (!mBudgetThrottleTimeouts || IsActive()) { return false; } // Check if there are any active IndexedDB databases
--- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -1826,16 +1826,23 @@ mirror: always # Time (in ms) that it takes to regenerate 1ms. - name: dom.timeout.foreground_budget_regeneration_rate type: int32_t value: 1 mirror: always +# Maximum value (in ms) for the background budget. Only valid for +# values greater than 0. +- name: dom.timeout.background_throttling_max_budget + type: int32_t + value: 50 + 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 type: bool value: true mirror: always # Maximum amount of time in milliseconds consecutive setTimeout()/setInterval()
--- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1080,19 +1080,16 @@ pref("dom.storage.snapshot_prefill", 163 pref("dom.storage.snapshot_gradual_prefill", 4096); pref("dom.storage.snapshot_reusing", true); pref("dom.storage.client_validation", true); pref("dom.send_after_paint_to_content", false); // Maximum value (in ms) for the background budget. Only valid for // values greater than 0. -pref("dom.timeout.background_throttling_max_budget", 50); -// Maximum value (in ms) for the background budget. Only valid for -// values greater than 0. pref("dom.timeout.foreground_throttling_max_budget", -1); // The maximum amount a timeout can be delayed by budget throttling pref("dom.timeout.budget_throttling_max_delay", 15000); // 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);