gecko-dev/hal/HalWakeLock.h
Andrew McCreight 285012cef5 Bug 1864522 - Remove unused functionality from ModifyWakeLock. r=gsvelto
- WakeLock is never registered as an observer, so remove its nsIObserver
  interface to eliminate a use of mContentParentID.

- mContentParentID is always CONTENT_PROCESS_ID_UNKNOWN, so propagate that
  through to hal::ModifyWakeLock().

- Compute the child ID on the receiver side of the ModifyWakeLock message,
  instead of passing it in the message. We always use the child ID of the
  ContentChild.

- Rename the old ModifyWakeLock into ModifyWakeLockWithChildID. Rename
  aProcessID to aChildID, because it is not a PID.

- Add a new hal::ModifyWakeLock for the parent process that uses
  CONTENT_PROCESS_ID_MAIN as the child id. This method is not actually called
  right now.

Differential Revision: https://phabricator.services.mozilla.com/D193577
2023-11-16 00:14:10 +00:00

35 lines
977 B
C++

/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __HAL_WAKELOCK_H_
#define __HAL_WAKELOCK_H_
namespace mozilla {
namespace hal {
enum WakeLockState {
WAKE_LOCK_STATE_UNLOCKED,
WAKE_LOCK_STATE_HIDDEN,
WAKE_LOCK_STATE_VISIBLE
};
/**
* Return the wake lock state according to the numbers.
*/
WakeLockState ComputeWakeLockState(int aNumLocks, int aNumHidden);
} // namespace hal
namespace hal_impl {
void ModifyWakeLockWithChildID(const nsAString& aTopic,
hal::WakeLockControl aLockAdjust,
hal::WakeLockControl aHiddenAdjust,
uint64_t aChildID);
} // namespace hal_impl
} // namespace mozilla
#endif /* __HAL_WAKELOCK_H_ */