author | Kristen Wright <kwright@mozilla.com> |
Fri, 26 Jul 2019 20:14:48 +0000 | |
changeset 485165 | 0a9a0b8b35fa6c7fc4a8a8ab15d189673e241604 |
parent 485164 | 760fd1f569808515a578292a661a06aa93f649e8 |
child 485166 | 1eee2a017f4e6ff8a763551276d7770df935830e |
push id | 36360 |
push user | ccoroiu@mozilla.com |
push date | Mon, 29 Jul 2019 21:38:39 +0000 |
treeherder | mozilla-central@927abd2c418b [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,19 +29,16 @@ using namespace mozilla; using namespace mozilla::dom; 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; namespace { double GetRegenerationFactor(bool aIsBackground) { // Lookup function for "dom.timeout.{background, // foreground}_budget_regeneration_rate". @@ -442,23 +439,16 @@ TimeoutManager::~TimeoutManager() { mExecutor->Shutdown(); mIdleExecutor->Shutdown(); MOZ_LOG(gTimeoutLog, LogLevel::Debug, ("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: return ++mIdleCallbackTimeoutCounter; case Timeout::Reason::eTimeoutOrInterval: default: return ++mTimeoutIdCounter; } @@ -1302,17 +1292,18 @@ void TimeoutManager::StartThrottlingTime MOZ_DIAGNOSTIC_ASSERT(mThrottleTimeoutsTimer); MOZ_LOG(gTimeoutLog, LogLevel::Debug, ("TimeoutManager %p started to throttle tracking timeouts\n", this)); MOZ_DIAGNOSTIC_ASSERT(!mThrottleTimeouts); mThrottleTimeouts = true; mThrottleTrackingTimeouts = true; - mBudgetThrottleTimeouts = gEnableBudgetTimeoutThrottling; + mBudgetThrottleTimeouts = + StaticPrefs::dom_timeout_enable_budget_timer_throttling(); mThrottleTimeoutsTimer = nullptr; } void TimeoutManager::OnDocumentLoaded() { // The load event may be firing again if we're coming back to the page by // navigating through the session history, so we need to ensure to only call // this when mThrottleTimeouts hasn't been set yet. if (!mThrottleTimeouts) {
--- a/dom/base/TimeoutManager.h +++ b/dom/base/TimeoutManager.h @@ -75,19 +75,16 @@ class TimeoutManager final { void Resume(); void Freeze(); void Thaw(); // This should be called by nsGlobalWindow when the window might have moved // 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(); // Run some code for each Timeout in our list. Note that this function // doesn't guarantee that Timeouts are iterated in any particular order. template <class Callable> void ForEachUnorderedTimeout(Callable c) {
--- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -902,26 +902,16 @@ nsGlobalWindowInner::nsGlobalWindowInner if (XRE_IsContentProcess()) { nsCOMPtr<nsIDocShell> docShell = GetDocShell(); if (docShell) { mBrowserChild = docShell->GetBrowserChild(); } } - // 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); if (!fname.IsEmpty()) { // If this fails to open, Dump() knows to just go to stdout on null. gDumpFile = fopen(fname.get(), "wb+"); } else { gDumpFile = stdout;
--- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -1846,16 +1846,22 @@ mirror: always # The maximum amount a timeout can be delayed by budget throttling. - name: dom.timeout.budget_throttling_max_delay type: int32_t 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 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 @@ -1078,19 +1078,16 @@ pref("dom.storage.default_quota", 5 pref("dom.storage.shadow_writes", true); pref("dom.storage.snapshot_prefill", 16384); 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); -// 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); // Enable <input type=color> by default. It will be turned off for remaining // platforms which don't have a color picker implemented yet. pref("dom.forms.color", true); // Support for input type=month, type=week and type=datetime-local. By default,