Bug 1570082 - Convert content.sink.enable_perf_mode to static pref r=njn

Converts content.sink.enable_perf_mode to a static pref. Also removes nsContentSink::InitializeStatics(), since this is the last varcache pref in the function.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
kriswright 2019-08-01 16:09:11 +00:00
parent 6f0aabcf43
commit f76ee44521
4 changed files with 12 additions and 15 deletions

View File

@ -134,12 +134,6 @@ nsContentSink::~nsContentSink() {
mDocument->RemoveObserver(this);
}
}
int32_t nsContentSink::sEnablePerfMode;
void nsContentSink::InitializeStatics() {
Preferences::AddIntVarCache(&sEnablePerfMode, "content.sink.enable_perf_mode",
0);
}
nsresult nsContentSink::Init(Document* aDoc, nsIURI* aURI,
nsISupports* aContainer, nsIChannel* aChannel) {
@ -173,8 +167,8 @@ nsresult nsContentSink::Init(Document* aDoc, nsIURI* aURI,
mBackoffCount = StaticPrefs::content_notify_backoffcount();
if (sEnablePerfMode != 0) {
mDynamicLowerValue = sEnablePerfMode == 1;
if (StaticPrefs::content_sink_enable_perf_mode() != 0) {
mDynamicLowerValue = StaticPrefs::content_sink_enable_perf_mode() == 1;
FavorPerformanceHint(!mDynamicLowerValue, 0);
}
@ -1483,7 +1477,7 @@ nsresult nsContentSink::WillParseImpl(void) {
uint32_t currentTime = PR_IntervalToMicroseconds(PR_IntervalNow());
if (sEnablePerfMode == 0) {
if (StaticPrefs::content_sink_enable_perf_mode() == 0) {
nsViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
uint32_t lastEventTime;

View File

@ -118,8 +118,6 @@ class nsContentSink : public nsICSSLoaderObserver,
bool LinkContextIsOurDocument(const nsAString& aAnchor);
bool Decode5987Format(nsAString& aEncoded);
static void InitializeStatics();
protected:
nsContentSink();
virtual ~nsContentSink();
@ -338,9 +336,6 @@ class nsContentSink : public nsICSSLoaderObserver,
nsRevocableEventPtr<nsRunnableMethod<nsContentSink, void, false> >
mProcessLinkHeaderEvent;
// Should we switch between perf-mode and interactive-mode
static int32_t sEnablePerfMode;
};
#endif // _nsContentSink_h_

View File

@ -245,7 +245,6 @@ nsresult nsLayoutStatics::Initialize() {
MediaManager::StartupInit();
CubebUtils::InitLibrary();
nsContentSink::InitializeStatics();
nsHtml5Module::InitializeStatics();
mozilla::dom::FallbackEncoding::Initialize();
nsLayoutUtils::Initialize();

View File

@ -1058,6 +1058,15 @@
value: 2000000
mirror: always
# Should we switch between perf-mode and interactive-mode?
# 0 = Switch
# 1 = Interactive mode
# 2 = Perf mode
- name: content.sink.enable_perf_mode
type: int32_t
value: 0
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "device."
#---------------------------------------------------------------------------