Commit c1562ec2 authored by Florian Queze's avatar Florian Queze
Browse files

Bug 1800412 - Add a preference to control whether the EcoQoS is used for...

Bug 1800412 - Add a preference to control whether the EcoQoS is used for background content processes, r=gsvelto, a=dsmith

Differential Revision: https://phabricator.services.mozilla.com/D161975
parent e5c684b3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2076,6 +2076,10 @@ pref("extensions.experiments.enabled", false);
  pref("dom.ipc.processPriorityManager.enabled", true);
#endif

#if defined(XP_WIN)
  pref("dom.ipc.processPriorityManager.backgroundUsesEcoQoS", true);
#endif

// Don't limit how many nodes we care about on desktop:
pref("reader.parse-node-limit", 0);

+12 −3
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include "Hal.h"
#include "HalLog.h"
#include "nsWindowsHelpers.h"  // for nsAutoHandle and nsModuleHandle
#include "mozilla/StaticPrefs_dom.h"

#include <windows.h>

@@ -42,6 +43,11 @@ void SetProcessPriority(int aPid, ProcessPriority aPriority) {
    static bool alreadyInitialized = false;
    static decltype(::SetProcessInformation)* setProcessInformation = nullptr;
    if (!alreadyInitialized) {
      if (aPriority == PROCESS_PRIORITY_PARENT_PROCESS ||
          !StaticPrefs::dom_ipc_processPriorityManager_backgroundUsesEcoQoS()) {
        return;
      }

      alreadyInitialized = true;
      // SetProcessInformation only exists on Windows 8 and later.
      nsModuleHandle module(LoadLibrary(L"Kernel32.dll"));
@@ -59,7 +65,10 @@ void SetProcessPriority(int aPid, ProcessPriority aPriority) {
    RtlZeroMemory(&PowerThrottling, sizeof(PowerThrottling));
    PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
    PowerThrottling.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
    PowerThrottling.StateMask = aPriority == PROCESS_PRIORITY_BACKGROUND
    PowerThrottling.StateMask =
        (aPriority == PROCESS_PRIORITY_BACKGROUND) &&
                StaticPrefs::
                    dom_ipc_processPriorityManager_backgroundUsesEcoQoS()
            ? PROCESS_POWER_THROTTLING_EXECUTION_SPEED
            : 0;
    if (setProcessInformation(processHandle, ProcessPowerThrottling,
+7 −0
Original line number Diff line number Diff line
@@ -2863,6 +2863,13 @@
#endif
  mirror: always

#ifdef XP_WIN
- name: dom.ipc.processPriorityManager.backgroundUsesEcoQoS
  type: bool
  value: false
  mirror: always
#endif

# Is support for HTMLElement.autocapitalize enabled?
- name: dom.forms.autocapitalize
  type: bool