Consider adding nsIAsync{Input,Output}Stream implementations for OS pipes
Categories
(Core :: XPCOM, enhancement)
Tracking
()
People
(Reporter: nika, Assigned: nika)
References
Details
Attachments
(2 external files, 1 obsolete file)
In our IPC code, we have an event loop for interacting with system level pipes/sockets in an async manner, but this is not really exposed to other consumers. This bug is to consider exposing this through XPCOM as a series of nsIAsync{Input,Output}Stream types.
The aim here is to make it easier for other components to take advantage of the async runtime we already use for our IPC backend.
| Assignee | ||
Comment 1•6 months ago
|
||
Updated•6 months ago
|
Comment 2•6 months ago
|
||
Updated•6 months ago
|
Updated•6 months ago
|
Comment 5•6 months ago
|
||
Backed out for causing build bustages at /AsyncPlatformPipes
Backout Link
Push with failures
Failure Log
Failure line ../../../../checkouts/gecko/xpcom/io/AsyncPlatformPipes.cpp:X:23: error: logical 'or' of equal expressions [-Werror=logical-op]
| Assignee | ||
Comment 6•6 months ago
|
||
This is a simple fix - I was missing an #if EWOULDBLOCK != EAGAIN check which is only necessary on old C++ compilers.
Comment 9•6 months ago
|
||
This is a new API which is intended to be used by code which wants to
perform async reads from native filesystem pipes. This does not support
async reads from "regular" files, as those are not compatible with
epoll.
Currently the API uses an owned buffer which is filled on the IPC I/O
thread, and read from on the user's thread. This is technically only
necessary for Windows (as non-Windows OSes could directly invoke read
during nsIInputStream::read method), This is because overlapped I/O on
Windows requires that the buffer be kept alive throughout the async
operation. So far I have made the call to always use the buffer for API
support consistency, but we could potentially change that behaviour.
The actual system file handle management is largely isolated to the
PlatformPipeLink type within the .cpp file. This is done to allow the
lifecycle of the nsIInputStream instance to be disconnected from the
lifecycle of the underlying pipe, as things like the buffer need to be
kept alive potentially longer than the stream to avoid issues on Windows
& handle cancelling I/O on destruction.
Currently there is no way to use this type with a shared file handle,
the file handle must be owned by the PlatformPipeLink.
Previous versions of this patch contained a PlatformPipeWriter type as
well, but that had some issues with lifecycle which I haven't yet
figured out yet, and turns out to not be necessary for the WebSerial
work right now, so are being left to a follow-up.
Original Revision: https://phabricator.services.mozilla.com/D294317
Updated•6 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
Comment 10•6 months ago
|
||
| uplift | ||
Description
•