Closed Bug 1602167 Opened 1 year ago Closed 1 year ago

Make it possible to pass more than just NS_DISPATCH_AT_END from a TaskQueue

Categories

(Core :: XPCOM, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: KrisWright, Assigned: KrisWright)

References

Details

Attachments

(1 file)

In Bug 1593812, a dispatch flag was added specifically for I/O awareness in the background thread pool [1]. This flag determines if the runnable needs to be dispatched to the general purpose background thread pool or the I/O background thread pool. However, if a TaskQueue running with NS_DISPATCH_EVENT_MAY_BLOCK has more tasks left in its queue, it will send itself to dispatch again to the wrong thread pool because it ignores its original flag and dispatches with NS_DISPATCH_AT_END [2].

I think the most straightforward way to fix it is to add an optional additional dispatch flag field specifically for flags like NS_DISPATCH_EVENT_MAY_BLOCK which determine which thread pool to dispatch in, assuming this issue may arise again later. In the future it may be worthwhile to create some way to pass more information than just a flag to dispatch.

[1] https://searchfox.org/mozilla-central/rev/0815480479c19646f9330377ffd8730515fca4ec/xpcom/threads/nsIEventTarget.idl#175
[2] https://searchfox.org/mozilla-central/rev/0815480479c19646f9330377ffd8730515fca4ec/xpcom/threads/TaskQueue.cpp#227

Summary: Make it possible to pass more than one of NSIThreadManager's dispatch flags → Make it possible to pass more than just NS_DISPATCH_AT_END from a TaskQueue

Makes TaskQueue's queue hold a struct with each runnable and its flags. When specified, flags will be stored and passed with NS_DISPATCH_AT_END when TaskQueue::Runner dispatches itself back to its event target.

Assignee: nobody → kwright
Pushed by kwright@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/473309c218b7
Make TaskQueue capable of retaining its dispatch flags r=froydnj
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
See Also: → 1646054
You need to log in before you can comment on or make changes to this bug.