author | kriswright <kwright@mozilla.com> |
Fri, 26 Jul 2019 20:32:25 +0000 | |
changeset 485178 | 89aacbb2f52f8905045c0aba8b21cbd9e8dc3d31 |
parent 485177 | 68cb4f3a31fde323e010323b085429b93e8628f6 |
child 485179 | 3d7f9cba78a7e60b287058e6d25e6818999ac0d9 |
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,22 +29,20 @@ using namespace mozilla; using namespace mozilla::dom; LazyLogModule gTimeoutLog("Timeout"); static int32_t gRunningTimeoutDepth = 0; -#define DEFAULT_FOREGROUND_BUDGET_REGENERATION_FACTOR 1 // 1ms per 1ms -#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_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 gForegroundBudgetRegenerationFactor = 0; 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; @@ -56,17 +54,17 @@ double GetRegenerationFactor(bool aIsBac // Returns the rate of regeneration of the execution budget as a // fraction. If the value is 1.0, the amount of time regenerated is // equal to time passed. At this rate we regenerate 1ms/ms. If it is // 0.01 the amount regenerated is 1% of time passed. At this rate we // regenerate 1ms/100ms, etc. double denominator = std::max( aIsBackground ? StaticPrefs::dom_timeout_background_budget_regeneration_rate() - : gForegroundBudgetRegenerationFactor, + : StaticPrefs::dom_timeout_foreground_budget_regeneration_rate(), 1); return 1.0 / denominator; } TimeDuration GetMaxBudget(bool aIsBackground) { // Lookup function for "dom.timeout.{background, // foreground}_throttling_max_budget". @@ -84,17 +82,17 @@ TimeDuration GetMinBudget(bool aIsBackgr // delay and computing how long time it would take to regenerate // that budget using the regeneration factor. This number is // expected to be negative. return TimeDuration::FromMilliseconds( -gBudgetThrottlingMaxDelay / std::max( aIsBackground ? StaticPrefs::dom_timeout_background_budget_regeneration_rate() - : gForegroundBudgetRegenerationFactor, + : StaticPrefs::dom_timeout_foreground_budget_regeneration_rate(), 1)); } } // namespace // bool TimeoutManager::IsBackground() const { return !IsActive() && mWindow.IsBackgroundInternal(); @@ -449,19 +447,16 @@ TimeoutManager::~TimeoutManager() { mIdleExecutor->Shutdown(); MOZ_LOG(gTimeoutLog, LogLevel::Debug, ("TimeoutManager %p destroyed\n", this)); } /* static */ void TimeoutManager::Initialize() { - Preferences::AddIntVarCache(&gForegroundBudgetRegenerationFactor, - "dom.timeout.foreground_budget_regeneration_rate", - DEFAULT_FOREGROUND_BUDGET_REGENERATION_FACTOR); 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",
--- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -1820,16 +1820,22 @@ mirror: always # Time (in ms) that it takes to regenerate 1ms. - name: dom.timeout.background_budget_regeneration_rate type: int32_t value: 100 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 + # 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 @@ -1081,18 +1081,16 @@ pref("dom.storage.snapshot_gradual_prefi 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); -// Time (in ms) that it takes to regenerate 1ms. -pref("dom.timeout.foreground_budget_regeneration_rate", 1); // 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);