1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
10 using namespace mozilla::hal
;
15 void SetProcessPriority(int aPid
, ProcessPriority aPriority
) {
16 HAL_LOG("WindowsProcessPriority - SetProcessPriority(%d, %s)\n", aPid
,
17 ProcessPriorityToString(aPriority
));
19 nsAutoHandle
processHandle(
20 ::OpenProcess(PROCESS_SET_INFORMATION
, FALSE
, aPid
));
22 DWORD priority
= NORMAL_PRIORITY_CLASS
;
23 if (aPriority
== PROCESS_PRIORITY_BACKGROUND
) {
24 priority
= IDLE_PRIORITY_CLASS
;
25 } else if (aPriority
== PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE
) {
26 priority
= BELOW_NORMAL_PRIORITY_CLASS
;
29 if (::SetPriorityClass(processHandle
, priority
)) {
30 HAL_LOG("WindowsProcessPriority - priority set to %d for pid %d\n",
36 } // namespace hal_impl
37 } // namespace mozilla