Bug 1569004 - Convert dom.min_timeout_value to StaticPref r=njn

Converts dom.min_timeout_value varcache pref from TimeoutManager::Initialize() to a static pref, and removes its entry and associated constants from TimeoutManager.cpp and all.js

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
kriswright 2019-07-26 19:15:44 +00:00
Родитель 429fb9a444
Коммит 0f96a859f0
3 изменённых файлов: 10 добавлений и 8 удалений

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

@ -8,6 +8,7 @@
#include "nsGlobalWindow.h"
#include "mozilla/Logging.h"
#include "mozilla/PerformanceCounter.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/Telemetry.h"
#include "mozilla/ThrottledEventQueue.h"
@ -34,11 +35,9 @@ LazyLogModule gTimeoutLog("Timeout");
static int32_t gRunningTimeoutDepth = 0;
// The default shortest interval/timeout we permit
#define DEFAULT_MIN_CLAMP_TIMEOUT_VALUE 4 // 4ms
#define DEFAULT_MIN_BACKGROUND_TIMEOUT_VALUE 1000 // 1000ms
#define DEFAULT_MIN_TRACKING_TIMEOUT_VALUE 4 // 4ms
#define DEFAULT_MIN_TRACKING_BACKGROUND_TIMEOUT_VALUE 1000 // 1000ms
static int32_t gMinClampTimeoutValue = 0;
static int32_t gMinBackgroundTimeoutValue = 0;
static int32_t gMinTrackingTimeoutValue = 0;
static int32_t gMinTrackingBackgroundTimeoutValue = 0;
@ -326,8 +325,9 @@ TimeDuration TimeoutManager::CalculateDelay(Timeout* aTimeout) const {
TimeDuration result = aTimeout->mInterval;
if (aTimeout->mNestingLevel >= DOM_CLAMP_TIMEOUT_NESTING_LEVEL) {
result = TimeDuration::Max(
result, TimeDuration::FromMilliseconds(gMinClampTimeoutValue));
uint32_t minTimeoutValue = StaticPrefs::dom_min_timeout_value();
result = TimeDuration::Max(result,
TimeDuration::FromMilliseconds(minTimeoutValue));
}
return result;
@ -479,8 +479,6 @@ TimeoutManager::~TimeoutManager() {
/* static */
void TimeoutManager::Initialize() {
Preferences::AddIntVarCache(&gMinClampTimeoutValue, "dom.min_timeout_value",
DEFAULT_MIN_CLAMP_TIMEOUT_VALUE);
Preferences::AddIntVarCache(&gMinBackgroundTimeoutValue,
"dom.min_background_timeout_value",
DEFAULT_MIN_BACKGROUND_TIMEOUT_VALUE);

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

@ -1423,6 +1423,12 @@
value: false
mirror: always
# Timeout clamp in ms for timeouts we clamp.
- name: dom.min_timeout_value
type: int32_t
value: 4
mirror: always
# Is support for module scripts (<script type="module">) enabled for content?
- name: dom.moduleScripts.enabled
type: bool

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

@ -1084,8 +1084,6 @@ pref("dom.storage.client_validation", true);
pref("dom.send_after_paint_to_content", false);
// Timeout clamp in ms for timeouts we clamp
pref("dom.min_timeout_value", 4);
// And for background windows
pref("dom.min_background_timeout_value", 1000);
// Timeout clamp in ms for tracking timeouts we clamp