Remove uniqueness constraint from nsAsyncShutdown
Categories
(Toolkit :: Async Tooling, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox115 | --- | fixed |
People
(Reporter: pehrsons, Assigned: pehrsons)
References
(Blocks 7 open bugs)
Details
Attachments
(2 files)
It would be great to avoid patterns like the below just to satisfy the uniqueness constraint:
- FileSystemShutdownBlocker generates a random id
- MediaRecorder appends its
thispointer - MediaTrackGraph appends its
thispointer - Document's UserInteractionTimer generates an ID and appends the document pointer
- BlobURLProtocolHandler's ReleasingTimerHolder appends its unique blob URL
- ContentParent appends its
thispointer - MediaDecoders use a singleton MediaShutdownManager but could probably be simplified to have one blocker per decoder
- SpeechRecognition appends its
thispointer
| Assignee | ||
Comment 1•2 years ago
|
||
We should remove the uniqueness constraint in the underlying
nsAsyncShutdownService instead.
| Assignee | ||
Comment 2•2 years ago
|
||
nsAsyncShutdownService is a common way to handle async shutdown in C++. The
uniqueness constraint on the name of the blocker is however an ergonomy problem.
Several classes will append a pointer, or even generate a random id, to satisfy
the uniqueness constraint and allow registering multiple blockers of the same
type.
This patch removes the uniqueness constraint, and changes from registering
blockers in a Map to a WeakMap as it seems to be in line with the original
author's intention, and is now possible.
Some test coverage of this exists through media::ShutdownBlockingTicket, see
https://phabricator.services.mozilla.com/D177616.
Comment 3•2 years ago
|
||
(In reply to Andreas Pehrson [:pehrsons] from comment #0)
This case is interesting because the author has included two kinds of information in the name:
- The
userInteractionTimerIdis there for uniqueness, and is unlikely to be useful for any kind of debugging. - The
aDocumentis added even though theuserInteractionTimerIdis sufficient for uniqueness, presumably because this pointer may be useful to match against other pointers in debugging.
So while the uniqueness requirement is unnecessary and causes extra pain in implementing an nsIAsyncShutdownBlocker, some of the pointers in blocker names could be useful for debugging, so we don't want to remove them all.
I'd agree that nsIAsyncShutdownBlocker need not impose uniqueness, just as AsyncShutdown does not. The client can choose what information is readily available and useful for debugging.
Updated•2 years ago
|
Comment 5•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/dc94b7583a39
https://hg.mozilla.org/mozilla-central/rev/5580f52f3e0b
Description
•