- 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
This adds a function GetHeterogeneousCpuInfo() to HAL, which
classifies the processor cores in to "big", "medium", and
"little". This is currently only implemented on Android, where it
works by parsing the maximum CPU frequency from sysfs.
When all CPUs have the same frequency they are all classified as
"big", and when there are only 2 different frequencies they are
classified as "big" and "little". All CPUs with a frequency in-between
the lowest and highest are classified as "medium".
This information can be used to count the number of each cores in each
category, eg for determining appropriate thread pool sizes. Or to
determine the indices of cores in a certain category, eg for setting
CPU affinity for certain threads.
Differential Revision: https://phabricator.services.mozilla.com/D188478
PerformanceHintManager is an Android API that allows the caller to
create a PerformanceHintSession, representing a workload shared by a
group of threads that should be completed within a target duration
each cycle. The actual duration spent working is reported each cycle,
and the system can then adjust scheduling of the threads accordingly
in order to hit the target going forward.
This patch adds the API to HAL along with an Android
implementation (and a nop fallback implementation for other
platforms).
Differential Revision: https://phabricator.services.mozilla.com/D186238
PerformanceHintManager is an Android API that allows the caller to
create a PerformanceHintSession, representing a workload shared by a
group of threads that should be completed within a target duration
each cycle. The actual duration spent working is reported each cycle,
and the system can then adjust scheduling of the threads accordingly
in order to hit the target going forward.
This patch adds the API to HAL along with an Android
implementation (and a nop fallback implementation for other
platforms).
Differential Revision: https://phabricator.services.mozilla.com/D186238
natural is defined as (from https://w3c.github.io/screen-orientation/#dfn-natural)
> A computer monitor are commonly naturally landscape-primary, while a mobile
> phones are commonly naturally portrait-primary.
But GeckoView sets `SCREEN_ORIENTATION_UNSPECIFIED` that is unlock orientation.
Like Blink, we should set landscape-primary or portrait-primary (depends on
current monitor).
Differential Revision: https://phabricator.services.mozilla.com/D164436
Now hal uses AR_STATE for screen orientation, so we should move it from
WinUtils.cpp to WinUtils.h for newer Windows 11 SDK.
Also, newer Windows SDK has to set WINVER to WIN8 to use auto rotation API.
Differential Revision: https://phabricator.services.mozilla.com/D163099
Since Windows tablet mode has a orientation lock API, this patch
implements orientation lock backend for Windows tablet mode.
`GetAutoRotationState` API recognizes whether orientation API is supported on
the device. So this fix uses this API to check orientation API capability.
Differential Revision: https://phabricator.services.mozilla.com/D162451
This patch implements hal::SetProcessPriority() on Linux and leverages
it to make it more likely that the parent process and foreground tab
survive an OOM situation, letting Linux' OOM killer reap preallocated
processes and background tabs first when reclaiming memory.
This is achieved by setting the `oom_score_adj` values of said processes
such that they will be killed in this order:
* Preallocated processes will be the first to go, they don't contain
user data and are not visible, so they're a good candidate to free up
memory
* Background tabs will be killed next, we don't generate crash reports
for thoes nor do we inform the user, we just reload the tab, so in
most cases one being killed will only be a small annoyance
* Background tabs playing video come next, but only if they're not also
playing or recording audio
* Finally foreground tabs will be killed as a last resort, background
tabs playing audio or with an active WebRTC session are also
considered to be in the foreground as the user will immediately notice
if they crash
Note that this patch only implements the low-level plumbing. The process
priority manager has not been enabled on Linux yet so that needs to
happen before this actually works.
Differential Revision: https://phabricator.services.mozilla.com/D153466
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.
Non-virtual actors can still use `nsString` if they need to on the
receiving end.
Differential Revision: https://phabricator.services.mozilla.com/D152519
For desktop this should basically have no impact (maybe impacts tab
warming, but if we wanted we could set the priority hint from the tab
switcher the same way we set renderLayers), but Fenix always has
renderLayers as true, effectively, so we were never de-prioritizing the
background tab processes.
Differential Revision: https://phabricator.services.mozilla.com/D145351
For desktop this should basically have no impact (maybe impacts tab
warming, but if we wanted we could set the priority hint from the tab
switcher the same way we set renderLayers), but Fenix always has
renderLayers as true, effectively, so we were never de-prioritizing the
background tab processes.
Differential Revision: https://phabricator.services.mozilla.com/D145351