Bug 1570212 - Convert three dom.ipc.* prefs into static prefs. r=mccr8

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-08-01 06:01:42 +00:00
parent c27392026e
commit 1e23726d7b
2 changed files with 22 additions and 20 deletions

View File

@ -14,6 +14,7 @@
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
#include "mozilla/Logging.h"
@ -144,9 +145,6 @@ class ProcessPriorityManagerImpl final : public nsIObserver,
void TabActivityChanged(BrowserParent* aBrowserParent, bool aIsActive);
private:
static bool sPrefsEnabled;
static bool sRemoteTabsDisabled;
static bool sTestMode;
static bool sPrefListenersRegistered;
static bool sInitialized;
static StaticRefPtr<ProcessPriorityManagerImpl> sSingleton;
@ -293,12 +291,6 @@ class ParticularProcessPriorityManager final : public WakeLockObserver,
/* static */
bool ProcessPriorityManagerImpl::sInitialized = false;
/* static */
bool ProcessPriorityManagerImpl::sPrefsEnabled = false;
/* static */
bool ProcessPriorityManagerImpl::sRemoteTabsDisabled = true;
/* static */
bool ProcessPriorityManagerImpl::sTestMode = false;
/* static */
bool ProcessPriorityManagerImpl::sPrefListenersRegistered = false;
/* static */
StaticRefPtr<ProcessPriorityManagerImpl> ProcessPriorityManagerImpl::sSingleton;
@ -323,12 +315,15 @@ void ProcessPriorityManagerImpl::PrefChangedCallback(const char* aPref,
/* static */
bool ProcessPriorityManagerImpl::PrefsEnabled() {
return sPrefsEnabled && hal::SetProcessPrioritySupported() &&
!sRemoteTabsDisabled;
return StaticPrefs::dom_ipc_processPriorityManager_enabled() &&
hal::SetProcessPrioritySupported() &&
!StaticPrefs::dom_ipc_tabs_disabled();
}
/* static */
bool ProcessPriorityManagerImpl::TestMode() { return sTestMode; }
bool ProcessPriorityManagerImpl::TestMode() {
return StaticPrefs::dom_ipc_processPriorityManager_testMode();
}
/* static */
void ProcessPriorityManagerImpl::StaticInit() {
@ -342,14 +337,6 @@ void ProcessPriorityManagerImpl::StaticInit() {
return;
}
if (!sPrefListenersRegistered) {
Preferences::AddBoolVarCache(&sPrefsEnabled,
"dom.ipc.processPriorityManager.enabled");
Preferences::AddBoolVarCache(&sRemoteTabsDisabled, "dom.ipc.tabs.disabled");
Preferences::AddBoolVarCache(&sTestMode,
"dom.ipc.processPriorityManager.testMode");
}
// If IPC tabs aren't enabled at startup, don't bother with any of this.
if (!PrefsEnabled()) {
LOG("InitProcessPriorityManager bailing due to prefs.");

View File

@ -1317,6 +1317,21 @@
value: false
mirror: always
- name: dom.ipc.tabs.disabled
type: bool
value: false
mirror: always
- name: dom.ipc.processPriorityManager.enabled
type: bool
value: false
mirror: always
- name: dom.ipc.processPriorityManager.testMode
type: bool
value: false
mirror: always
# Is support for input type=date and type=time enabled?
- name: dom.forms.datetime
type: bool