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

Converts varcache prefs content.sink.interactive_parse_time and content.sink.perf_parse_time to static prefs.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
kriswright 2019-08-01 17:15:49 +00:00
parent 838f415ab4
commit a6e61ca131
4 changed files with 20 additions and 14 deletions

View File

@ -134,17 +134,11 @@ nsContentSink::~nsContentSink() {
mDocument->RemoveObserver(this);
}
}
int32_t nsContentSink::sInteractiveParseTime;
int32_t nsContentSink::sPerfParseTime;
int32_t nsContentSink::sInteractiveTime;
int32_t nsContentSink::sInitialPerfTime;
int32_t nsContentSink::sEnablePerfMode;
void nsContentSink::InitializeStatics() {
Preferences::AddIntVarCache(&sInteractiveParseTime,
"content.sink.interactive_parse_time", 3000);
Preferences::AddIntVarCache(&sPerfParseTime, "content.sink.perf_parse_time",
360000);
Preferences::AddIntVarCache(&sInteractiveTime,
"content.sink.interactive_time", 750000);
Preferences::AddIntVarCache(&sInitialPerfTime,
@ -1516,8 +1510,9 @@ nsresult nsContentSink::WillParseImpl(void) {
mHasPendingEvent = false;
mCurrentParseEndTime =
currentTime +
(mDynamicLowerValue ? sInteractiveParseTime : sPerfParseTime);
currentTime + (mDynamicLowerValue
? StaticPrefs::content_sink_interactive_parse_time()
: StaticPrefs::content_sink_perf_parse_time());
return NS_OK;
}

View File

@ -339,9 +339,6 @@ class nsContentSink : public nsICSSLoaderObserver,
nsRevocableEventPtr<nsRunnableMethod<nsContentSink, void, false> >
mProcessLinkHeaderEvent;
// How long to stay off the event loop in interactive/perf modes
static int32_t sInteractiveParseTime;
static int32_t sPerfParseTime;
// How long to be in interactive mode after an event
static int32_t sInteractiveTime;
// How long to stay in perf mode after initial loading

View File

@ -1034,6 +1034,18 @@
value: 1
mirror: always
# How long to stay off the event loop in interactive mode.
- name: content.sink.interactive_parse_time
type: int32_t
value: 3000
mirror: always
# How long to stay off the event loop in perf mode.
- name: content.sink.perf_parse_time
type: int32_t
value: 360000
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "device."
#---------------------------------------------------------------------------

View File

@ -14,6 +14,7 @@
#include "mozAutoDocUpdate.h"
#include "mozilla/IdleTaskRunner.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_content.h"
#include "mozilla/StaticPrefs_security.h"
#include "mozilla/StaticPrefs_view_source.h"
#include "mozilla/css/Loader.h"
@ -315,9 +316,10 @@ void nsHtml5TreeOpExecutor::ContinueInterruptedParsingAsync() {
&BackgroundFlushCallback,
"nsHtml5TreeOpExecutor::BackgroundFlushCallback",
250, // The hard deadline: 250ms.
nsContentSink::sInteractiveParseTime / 1000, // Required budget.
true, // repeating
[] { return false; }); // MayStopProcessing
StaticPrefs::content_sink_interactive_parse_time() /
1000, // Required budget.
true, // repeating
[] { return false; }); // MayStopProcessing
}
}