PSA: Readable Byte Streams updates in Blink Implementation

15 views
Skip to first unread message

Nidhi Jaju

unread,
Oct 13, 2021, 10:29:35 AM10/13/21
to blink-dev, Adam Rice
Hi all,

(If you do not work with readable byte streams, you can ignore this.)

We have recently submitted some CLs for updating readable byte streams in the Blink Implementation based on the latest spec changes in the Streams API standard. These updates fix various issues related to readable byte streams and improve standards compliance.

These changes include:
- respondWithNewView(newView) can now be called with a new view that is smaller than the BYOB request's view
- respondWithNewView() cannot be called with a non-empty view when the stream is closed
- respondWithNewView(newView) must now be called with a view whose buffer has the same length as that of the BYOB request
- enqueue(chunk) and respondWithNewView(newView) now checks that the given view's buffer is actually transferable
- enqueue() and respond() now checks that the BYOB request's view has not been transferred
- enqueue(), respond() and respondWithNewView() immediately invalidates the BYOB request
- Any pending BYOB reads are now resolved immediately on cancel()
- enqueue() now discards the BYOB request if it was auto-allocated

(For reference: https://chromium-review.googlesource.com/c/chromium/src/+/3216570, https://chromium-review.googlesource.com/c/chromium/src/+/3216778, and https://chromium-review.googlesource.com/c/chromium/src/+/3213786)

Cheers,
Nidhi Jaju

Reilly Grant

unread,
Oct 13, 2021, 12:59:44 PM10/13/21
to Nidhi Jaju, blink-dev, Adam Rice
This is somewhat of a tangent but I'm curious what the use case for respondWithNewView() is when it seems like the "new" view can only be the existing view but shorter. It seems equivalent to calling respondWith(newView.byteLength).
Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMZNYAN7VSVpdd5v8mK0otwRF6-w9ezsP3dyqm-wO-bWS%3DKvSQ%40mail.gmail.com.

Adam Rice

unread,
Oct 13, 2021, 1:06:09 PM10/13/21
to Reilly Grant, Nidhi Jaju, blink-dev
Yes. The only use case of respondWithNewView() is when you've transferred the ArrayBuffer and so you can't use respond(). Most people will never need it.
Reply all
Reply to author
Forward
0 new messages