forked from mirrors/gecko-dev
Bug 1800412 - Add a preference to control whether the EcoQoS is used for background content processes, r=gsvelto.
Differential Revision: https://phabricator.services.mozilla.com/D161975
This commit is contained in:
parent
47ba0361d4
commit
96cc120704
3 changed files with 23 additions and 3 deletions
|
|
@ -2076,6 +2076,10 @@ pref("extensions.experiments.enabled", false);
|
||||||
pref("dom.ipc.processPriorityManager.enabled", true);
|
pref("dom.ipc.processPriorityManager.enabled", true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(XP_WIN)
|
||||||
|
pref("dom.ipc.processPriorityManager.backgroundUsesEcoQoS", true);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Don't limit how many nodes we care about on desktop:
|
// Don't limit how many nodes we care about on desktop:
|
||||||
pref("reader.parse-node-limit", 0);
|
pref("reader.parse-node-limit", 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Hal.h"
|
#include "Hal.h"
|
||||||
#include "HalLog.h"
|
#include "HalLog.h"
|
||||||
#include "nsWindowsHelpers.h" // for nsAutoHandle and nsModuleHandle
|
#include "nsWindowsHelpers.h" // for nsAutoHandle and nsModuleHandle
|
||||||
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
@ -42,6 +43,11 @@ void SetProcessPriority(int aPid, ProcessPriority aPriority) {
|
||||||
static bool alreadyInitialized = false;
|
static bool alreadyInitialized = false;
|
||||||
static decltype(::SetProcessInformation)* setProcessInformation = nullptr;
|
static decltype(::SetProcessInformation)* setProcessInformation = nullptr;
|
||||||
if (!alreadyInitialized) {
|
if (!alreadyInitialized) {
|
||||||
|
if (aPriority == PROCESS_PRIORITY_PARENT_PROCESS ||
|
||||||
|
!StaticPrefs::dom_ipc_processPriorityManager_backgroundUsesEcoQoS()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
alreadyInitialized = true;
|
alreadyInitialized = true;
|
||||||
// SetProcessInformation only exists on Windows 8 and later.
|
// SetProcessInformation only exists on Windows 8 and later.
|
||||||
nsModuleHandle module(LoadLibrary(L"Kernel32.dll"));
|
nsModuleHandle module(LoadLibrary(L"Kernel32.dll"));
|
||||||
|
|
@ -59,9 +65,12 @@ void SetProcessPriority(int aPid, ProcessPriority aPriority) {
|
||||||
RtlZeroMemory(&PowerThrottling, sizeof(PowerThrottling));
|
RtlZeroMemory(&PowerThrottling, sizeof(PowerThrottling));
|
||||||
PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
|
PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
|
||||||
PowerThrottling.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
|
PowerThrottling.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
|
||||||
PowerThrottling.StateMask = aPriority == PROCESS_PRIORITY_BACKGROUND
|
PowerThrottling.StateMask =
|
||||||
? PROCESS_POWER_THROTTLING_EXECUTION_SPEED
|
(aPriority == PROCESS_PRIORITY_BACKGROUND) &&
|
||||||
: 0;
|
StaticPrefs::
|
||||||
|
dom_ipc_processPriorityManager_backgroundUsesEcoQoS()
|
||||||
|
? PROCESS_POWER_THROTTLING_EXECUTION_SPEED
|
||||||
|
: 0;
|
||||||
if (setProcessInformation(processHandle, ProcessPowerThrottling,
|
if (setProcessInformation(processHandle, ProcessPowerThrottling,
|
||||||
&PowerThrottling, sizeof(PowerThrottling))) {
|
&PowerThrottling, sizeof(PowerThrottling))) {
|
||||||
HAL_LOG("SetProcessInformation(%d, %s)\n", aPid,
|
HAL_LOG("SetProcessInformation(%d, %s)\n", aPid,
|
||||||
|
|
|
||||||
|
|
@ -2863,6 +2863,13 @@
|
||||||
#endif
|
#endif
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
|
#ifdef XP_WIN
|
||||||
|
- name: dom.ipc.processPriorityManager.backgroundUsesEcoQoS
|
||||||
|
type: bool
|
||||||
|
value: false
|
||||||
|
mirror: always
|
||||||
|
#endif
|
||||||
|
|
||||||
# Is support for HTMLElement.autocapitalize enabled?
|
# Is support for HTMLElement.autocapitalize enabled?
|
||||||
- name: dom.forms.autocapitalize
|
- name: dom.forms.autocapitalize
|
||||||
type: bool
|
type: bool
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue