Convert mscom::Ensure to use the background thread pool when possible
Categories
(Core :: IPC: MSCOM, task, P3)
Tracking
()
People
(Reporter: KrisWright, Unassigned)
References
(Blocks 1 open bug)
Details
The thread COM MTA
[1] uses the NS_NewNamedThread
method, so it might be possible to move it to the background thread pool.
In an effort to reduce the number of ad-hoc threads in the browser, we want to convert instances of NS_NewNamedThread
to use the background thread pool [2] wherever possible. If your thread may block, you can also include the NS_DISPATCH_EVENT_MAY_BLOCK
flag.
[1] https://searchfox.org/mozilla-central/rev/c79c0d65a183d9d38676855f455a5c6a7f7dadd3/ipc/mscom/EnsureMTA.cpp#35
[2] https://searchfox.org/mozilla-central/rev/91f6c02fcf4c16f78fdc4417f61f192688294066/xpcom/threads/nsThreadUtils.h#1730-1757
Comment 1•4 years ago
|
||
Sorry, as much as I'd like to, this one can't be changed over to use a background thread pool; its presence is required to maintain state specific to Microsoft COM.
Comment 2•4 years ago
|
||
I wonder if it would make sense to add a comment to our codebase where we explain why a thread is needed, ie:
// Bug 1620368 - This thread is required to maintain state specific to Microsoft COM
Comment 3•4 years ago
|
||
We might be able to shut this thread down after COM initialization has completed and then use the pool for remaining work, but I think we'd need some additional enhancements to the background thread pool to make that possible. I'll file a bug.
Comment 4•4 years ago
|
||
I filed bug 1626346 for the required prerequisite. Reopening provided that we follow the guidance I outlined in comment 3.
Comment 5•2 years ago
|
||
(In reply to (No longer employed by Mozilla) Aaron Klotz from comment #4)
I filed bug 1626346 for the required prerequisite. Reopening provided that we follow the guidance I outlined in comment 3.
Bug 1626346 is no longer relevant after bug 1707954, since all background threads are now implicitly part of the MTA. So, we should be able to shut down the mscom persistent MTA thread once ProcessRuntime initialisation is complete and dispatch any subsequent EnsureMTA calls via the background thread pool.
Updated•2 years ago
|
Description
•