Bug 1573268 - Convert two layout.idle-period.* prefs to static prefs. r=njn

Converts layout.idle_period.required_quiescent_frames and layout.idle_period.time_limit to static prefs. These are the last prefs in nsLayoutUtils::initialize(), but since the function still calls nsComputedDOMStyle::RegisterPrefChangeCallbacks() the commit retains it.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2019-08-14 19:36:46 +00:00
parent 61d69ccebf
commit 6bfb2c7c85
5 changed files with 17 additions and 38 deletions

View File

@ -168,13 +168,6 @@ using namespace mozilla::gfx;
using mozilla::dom::HTMLMediaElement_Binding::HAVE_METADATA;
using mozilla::dom::HTMLMediaElement_Binding::HAVE_NOTHING;
// The time in number of frames that we estimate for a refresh driver
// to be quiescent
#define DEFAULT_QUIESCENT_FRAMES 2
// The time (milliseconds) we estimate is needed between the end of an
// idle time and the next Tick.
#define DEFAULT_IDLE_PERIOD_TIME_LIMIT 1.0f
#ifdef DEBUG
// TODO: remove, see bug 598468.
bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
@ -183,11 +176,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
typedef ScrollableLayerGuid::ViewID ViewID;
typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
/* static */
uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
/* static */
uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
static ViewID sScrollIdCounter = ScrollableLayerGuid::START_SCROLL_ID;
typedef nsDataHashtable<nsUint64HashKey, nsIContent*> ContentMap;
@ -7961,13 +7949,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
/* static */
void nsLayoutUtils::Initialize() {
Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
"layout.idle_period.time_limit",
DEFAULT_IDLE_PERIOD_TIME_LIMIT);
Preferences::AddUintVarCache(&sQuiescentFramesBeforeIdlePeriod,
"layout.idle_period.required_quiescent_frames",
DEFAULT_QUIESCENT_FRAMES);
nsComputedDOMStyle::RegisterPrefChangeCallbacks();
}

View File

@ -2442,12 +2442,6 @@ class nsLayoutUtils {
static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
static uint32_t IdlePeriodDeadlineLimit() { return sIdlePeriodDeadlineLimit; }
static uint32_t QuiescentFramesBeforeIdlePeriod() {
return sQuiescentFramesBeforeIdlePeriod;
}
/**
* Returns true if the nglayout.debug.invalidation pref is set to true.
*/
@ -2992,9 +2986,6 @@ class nsLayoutUtils {
const nsIFrame* aFrame);
private:
static uint32_t sIdlePeriodDeadlineLimit;
static uint32_t sQuiescentFramesBeforeIdlePeriod;
/**
* Helper function for LogTestDataForPaint().
*/

View File

@ -271,13 +271,14 @@ class RefreshDriverTimer {
TimeStamp idleEnd = mostRecentRefresh + refreshRate;
if (idleEnd +
refreshRate * nsLayoutUtils::QuiescentFramesBeforeIdlePeriod() <
refreshRate *
StaticPrefs::layout_idle_period_required_quiescent_frames() <
TimeStamp::Now()) {
return aDefault;
}
idleEnd = idleEnd - TimeDuration::FromMilliseconds(
nsLayoutUtils::IdlePeriodDeadlineLimit());
StaticPrefs::layout_idle_period_time_limit());
return idleEnd < aDefault ? idleEnd : aDefault;
}

View File

@ -4649,6 +4649,20 @@
value: -1
mirror: always
# The time in number of frames that we estimate for a refresh driver
# to be quiescent.
- name: layout.idle_period.required_quiescent_frames
type: uint32_t
value: 2
mirror: always
# The amount of time (milliseconds) needed between an idle period's
# end and the start of the next tick to avoid jank.
- name: layout.idle_period.time_limit
type: uint32_t
value: 1
mirror: always
# Enable/disable interruptible reflow, which allows reflows to stop
# before completion (and display the partial results) when user events
# are pending.

View File

@ -2985,14 +2985,6 @@ pref("layout.display-list.rebuild-frame-limit", 500);
// pref to control whether layout warnings that are hit quite often are enabled
pref("layout.spammy_warnings.enabled", false);
// The number of frames times the frame rate is the time required to
// pass without painting used to guess that we'll not paint again soon
pref("layout.idle_period.required_quiescent_frames", 2);
// The amount of time (milliseconds) needed between an idle period's
// end and the start of the next tick to avoid jank.
pref("layout.idle_period.time_limit", 1);
// Pref to throttle offsreen animations
pref("dom.animations.offscreen-throttling", true);