Open Bug 1274815 Opened 5 years ago Updated 4 years ago
Destination result ns IInput Stream pass IPC string buffers instead of using ns Pipe
Currently the receiving end of the PSendStream actor simply copies data into an nsPipe. The reading side of the pipe is then passed when "deserialized" back into an nsIInputStream. In theory we can save a copy here. Instead of using an nsPipe we can instead create a "string list" nsIInputStream. This would provide an API letting nsCString objects be appended to the stream. Each nsCString would then be available as a single segment to ReadSegments(), etc. Since nsCString uses a CoW strategy this would avoid copying.
Note that bug 1351488's https://hg.mozilla.org/mozilla-central/rev/08d40ce6531e changed PChildToParentStream and PParentToChildStream to use wr:ByteBuffers instead of nsCStrings. I r+'ed that with the knowledge that this might impede CoW efforts like are proposed here, but I didn't realize was actually proposed. The good news is we can just as easily create a stream that we provide with buffers to adopt as we can create the string variant. (Unfortunately nsPipe uses nsSegmentedBuffer under the hood and that is written to assume a constant segment size, as does nsStorageStream, so it's not trivial to simply reuse existing stream implementations.)
Summary: Make PSendStream result nsIInputStream pass IPC string buffers instead of using nsPipe → Make IPCStreamDestination result nsIInputStream pass IPC string buffers instead of using nsPipe
You need to log in before you can comment on or make changes to this bug.