Backed out changeset cd96e020a609 (bug 1747138) for causing bc failures in browser_telemetry_video_hardware_decoding_support. CLOSED TREE

This commit is contained in:
smolnar
2022-02-03 19:51:02 +02:00
parent 91924d8149
commit c3e516dd0e
11 changed files with 31 additions and 511 deletions

View File

@@ -172,7 +172,6 @@ class ProcessPriorityManagerImpl final : public nsIObserver,
static void StaticInit();
static bool PrefsEnabled();
static void SetProcessPriorityIfEnabled(int aPid, ProcessPriority aPriority);
static bool TestMode();
NS_DECL_ISUPPORTS
@@ -366,17 +365,6 @@ bool ProcessPriorityManagerImpl::PrefsEnabled() {
!StaticPrefs::dom_ipc_tabs_disabled();
}
/* static */
void ProcessPriorityManagerImpl::SetProcessPriorityIfEnabled(
int aPid, ProcessPriority aPriority) {
// The preference doesn't disable the process priority manager, but only its
// effect. This way the IPCs still happen and can be used to collect telemetry
// about CPU use.
if (PrefsEnabled()) {
hal::SetProcessPriority(aPid, aPriority);
}
}
/* static */
bool ProcessPriorityManagerImpl::TestMode() {
return StaticPrefs::dom_ipc_processPriorityManager_testMode();
@@ -394,13 +382,20 @@ void ProcessPriorityManagerImpl::StaticInit() {
return;
}
// Run StaticInit() again if the prefs change. We don't expect this to
// happen in normal operation, but it happens during testing.
if (!sPrefListenersRegistered) {
sPrefListenersRegistered = true;
Preferences::RegisterCallback(PrefChangedCallback,
"dom.ipc.processPriorityManager.enabled");
Preferences::RegisterCallback(PrefChangedCallback, "dom.ipc.tabs.disabled");
// If IPC tabs aren't enabled at startup, don't bother with any of this.
if (!PrefsEnabled()) {
LOG("InitProcessPriorityManager bailing due to prefs.");
// Run StaticInit() again if the prefs change. We don't expect this to
// happen in normal operation, but it happens during testing.
if (!sPrefListenersRegistered) {
sPrefListenersRegistered = true;
Preferences::RegisterCallback(PrefChangedCallback,
"dom.ipc.processPriorityManager.enabled");
Preferences::RegisterCallback(PrefChangedCallback,
"dom.ipc.tabs.disabled");
}
return;
}
sInitialized = true;
@@ -431,7 +426,7 @@ void ProcessPriorityManagerImpl::Init() {
// The parent process's priority never changes; set it here and then forget
// about it. We'll manage only subprocesses' priorities using the process
// priority manager.
SetProcessPriorityIfEnabled(getpid(), PROCESS_PRIORITY_PARENT_PROCESS);
hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_PARENT_PROCESS);
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
@@ -767,7 +762,8 @@ void ParticularProcessPriorityManager::SetPriorityNow(
return;
}
if (!mContentParent || mPriority == aPriority) {
if (!ProcessPriorityManagerImpl::PrefsEnabled() || !mContentParent ||
mPriority == aPriority) {
return;
}
@@ -798,7 +794,7 @@ void ParticularProcessPriorityManager::SetPriorityNow(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_LOWERED, 1);
}
ProcessPriorityManagerImpl::SetProcessPriorityIfEnabled(Pid(), mPriority);
hal::SetProcessPriority(Pid(), mPriority);
if (oldPriority != mPriority) {
ProcessPriorityManagerImpl::GetSingleton()->NotifyProcessPriorityChanged(