I have one question about what you get back with you call getReader().
You write that such code will continue to work. Does that mean that the
return value is the same or does it mean that what you get back has the
exact same API surface as what you got before?
/Daniel
On 2022-08-10 17:56, Mike Taylor wrote:
LGTM2
On 8/10/22 9:15 AM, Yoav Weiss wrote:
LGTM1
On Tuesday, August 9, 2022 at 3:39:32 AM UTC+2 Reilly Grant wrote:
Contact emails
reil...@chromium.org
Explainer
Full explainer should not be necessary; see the Summary section
below for an overview of this change
Specification
https://wicg.github.io/serial/#readable-attribute
<https://wicg.github.io/serial/#readable-attribute>
Summary
The SerialPortinterface provides a ReadableStream and
WritableStream for communication with the connected device. This
change updates the underlying data source for the
ReadableStreamto make it a readable byte stream
<https://streams.spec.whatwg.org/#readable-byte-stream>. This is
how this stream should have originally been specified but at the
time Chromium did not support implementing byte streams in C++.
This has recently been fixed
<https://bugs.chromium.org/p/chromium/issues/detail?id=1284571>and
so this change can be implemented. The change is backwards
compatible because existing code calling
port.readable.getReader()will continue to work while new code can
detect support for BYOB readers by calling getReader({ mode:
'byob' })and catching the TypeErrorthrown by older implementations.
BYOB readers allow developers to specify the buffer into which
data is read instead of the stream allocating a buffer for each
chunk. In addition to the potential reduction in memory pressure
this allows script to control how much data is received in a
chunk as the stream cannot return more than there is space for in
the provided buffer.
The ability to read a particular amount of data from a port has
been a frequently requested feature by developers used to
programming against the Windows and POSIX APIs for serial
devices, which operate on this same "bring your own buffer"
principle. The current API, in contrast, requires developers to
code defensively against extra unwanted data instead of receiving
only what they are ready to process.
Blink component
Blink>Serial
<https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3ESerial>
TAG review
https://github.com/w3ctag/design-reviews/issues/431
<https://github.com/w3ctag/design-reviews/issues/431>
https://github.com/w3ctag/design-reviews/issues/567
<https://github.com/w3ctag/design-reviews/issues/567>
TAG review status
Not applicable, the W3C TAG has already reviewed the Web Serial
and byte stream APIs independently. This change integrates them
in an obvious manner.
Risks
Interoperability and Compatibility
Gecko: Harmful
(https://mozilla.github.io/standards-positions/#webserial
<https://mozilla.github.io/standards-positions/#webserial>)
Mozilla is opposed to the Web Serial API in general. This
incremental change is not expected to change their position.
WebKit: Negative (https://webkit.org/tracking-prevention
<https://webkit.org/tracking-prevention>)
Apple is opposed to the Web Serial API in general. This
incremental change is not expected to change their position.
Web developers: Positive
(https://github.com/WICG/serial/issues/125#issuecomment-786937083
<https://github.com/WICG/serial/issues/125#issuecomment-786937083>)
Multiple developers have asked for the ability to read a specific
number of bytes from the port, which is enabled by using a BYOB
reader.
WebView application risks
WebView is not supported because this API is not available on
Android.
Debuggability
This feature is debuggable using the normal DevTools JavaScript
debugger.
Will this feature be supported on all six Blink platforms
(Windows, Mac, Linux, Chrome OS, Android, and Android
WebView)?
No, the Web Serial API is only available on desktop platforms
because Android does not provide a serial API. A polyfill
<https://github.com/google/web-serial-polyfill>for Android which
uses WebUSB (and can be expanded using Web Bluetooth) provides an
implementation of the missing platform features. An issue
<https://github.com/google/web-serial-polyfill/issues/42>has been
filed to update the polyfill with BYOB reader support.
Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>?
Yes (in the patch
<https://chromium-review.googlesource.com/c/chromium/src/+/3811977/4/third_party/blink/web_tests/external/wpt/serial/serialPort_readable_byob.https.any.js>)
Requires code in //chrome?
No
Tracking bug
https://bugs.chromium.org/p/chromium/issues/detail?id=1182905
<https://bugs.chromium.org/p/chromium/issues/detail?id=1182905>
Sample links
https://googlechromelabs.github.io/serial-terminal
<https://googlechromelabs.github.io/serial-terminal>
Estimated milestones
M-106
Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/6716022686482432
<https://chromestatus.com/feature/6716022686482432>
This intent message was generated by Chrome Platform Status
<https://chromestatus.com/>and lovingly edited by hand.
Reilly Grant | Software Engineer |reil...@chromium.org |Google
Chrome <https://www.google.com/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+unsubscr...@chromium.org.
To view this discussion on the web visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/4c022c60-2d3e-4976-883d-80cbe6639845n%40chromium.org
<https://groups.google.com/a/chromium.org/d/msgid/blink-dev/4c022c60-2d3e-4976-883d-80cbe6639845n%40chromium.org?utm_medium=email&utm_source=footer>.
--
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+unsubscr...@chromium.org.
To view this discussion on the web visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e077fb3a-6757-589b-b240-34bf19ace508%40chromium.org
<https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e077fb3a-6757-589b-b240-34bf19ace508%40chromium.org?utm_medium=email&utm_source=footer>.
--
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+unsubscr...@chromium.org.
To view this discussion on the web visit
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/7699d92d-e05c-6f2c-1508-1c65617b8ae3%40gmail.com.