Re: [whatwg/streams] Allow other specifications to create readable byte streams (#1121)

> That's an interesting question. As currently implemented in Chromium there is a shared memory buffer between the browser process and renderer process and the size of the buffer is options["bufferSize"]. Reading from the serial port occurs in the browser process so no matter how large the BYOB request's buffer is there will never be more than options["bufferSize"] bytes available to copy into it. The fetch() API uses a similar architecture, but with the fixed 64k buffer @MattiasBuelens mentioned.

This seems reasonable to me. The exposure of implementation internals is somewhat unfortunate, but seems unavoidable. In general, some implementation strategies will be able to use the full range of the BYOB request buffer, and some won't.

Web Serial actually seems to be in a better situation than Fetch, since it has explicit developer control via bufferSize, so it'd be more likely to be interoperable. I.e., its spec could explicitly say that at most bufferSize bytes will be filled in the BYOB request, even if you pass a larger one.

I might try to write up a tentative spec patch soon for this (maybe even a Web Serial patch too) and see how it goes.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1121#issuecomment-816257376

Received on Thursday, 8 April 2021 22:01:00 UTC