Put all background process Main Threads on Macos in the background
Categories
(Core :: XPCOM, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox114 | --- | fixed |
People
(Reporter: KrisWright, Assigned: KrisWright)
References
Details
Attachments
(1 file, 1 obsolete file)
Followup for bug 1748378, we can use this API to put all XPCOM threads in the background. We follow a few particular steps:
- Identify some
IsOperatingInBackground
atomic, likely held by the thread manager - When threads see this value (eg not doing any work), they may put themselves in the background
- Threads may save their previous operating state to restore when leaving the background.
I think this process may also work for the main thread by sending a task directly to the main thread to set/unset itself.
Assignee | ||
Comment 1•2 years ago
|
||
Depends on D146534
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
This part is especially tricky and what exists here so far is what I am using to test the behavior. Notifying the threads that they need to go into the background is where the main hangup is - preventing spurious wakeups while also noticing the change. To solve this I am dealing with a global background value which threads can check during dispatch. If they notice there has been a measurable change, they can dispatch to their own event target first a method to set themselves into the background. I haven't worked out yet how we'll be notifying the mechanism of the changes.
Depends on D167952
Comment 4•2 years ago
|
||
bugherder |
Comment 5•2 years ago
|
||
Comment on attachment 9326333 [details]
WIP: Bug 1805932 - Implement background behavior for all nsThreads.
Revision D174309 was moved to bug 1832368. Setting attachment 9326333 [details] to obsolete.
Assignee | ||
Comment 6•2 years ago
|
||
We split up the mainthread work and any offthread work so we can move forward with testing new changes. Work on offthread changes will continue in bug 1832368.
Updated•9 months ago
|
Description
•