Closed Bug 1734700 Opened 4 months ago Closed 3 months ago

IOUtils uses the CPU-intensive threadpool for blocking IO

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: nika, Assigned: nika)

Details

Attachments

(1 file)

IOUtils dispatches to a nsISerialEventTarget from NS_CreateBackgroundTaskQueue (https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/dom/system/IOUtils.cpp#1537-1538), and then dispatches with InvokeAsync (https://searchfox.org/mozilla-central/rev/b847c844adf49013067281d3237e7ada24325a34/dom/system/IOUtils.cpp#1600-1607), which always calls Dispatch without flag arguments. Because of this, the NS_DISPATCH_EVENT_MAY_BLOCK flag is not set on the dispatches, despite blocking I/O being performed.

We should add a way to specify NS_DISPATCH_EVENT_MAY_BLOCK when calling InvokeAsync (perhaps an InvokeAsyncIO?) and use it in these functions.

In addition, it may be useful in the future to have some way to wrap/mark a nsISerialEventTarget to always consider tasks dispatched to it as NS_DISPATCH_EVENT_MAY_BLOCK for call-sites like these which accept an event target, but provide no mechanism to customize the flags passed to Dispatch.

Assignee: nobody → nika
Status: NEW → ASSIGNED
Pushed by nlayzell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/584a442f7d7b
Use the IO event queue for IOUtils background tasks, r=KrisWright
Pushed by nlayzell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a85e1d7d78b5
Use the IO event queue for IOUtils background tasks, r=KrisWright
Flags: needinfo?(nika)
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.