-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
streams: pipeTo a WS with HWM>1 #5262
Conversation
Notifying @calvaris, @domenic, @ricea, @tyoshino, @wanderview, @youennf, and @yutakahirano. (Learn how reviewing works.) |
Firefox (nightly channel)Testing web-platform-tests at revision 5430c5b All results6 tests ran/console/console-timeline-timelineEnd-historical.any.html
/console/console-timeline-timelineEnd-historical.any.worker.html
/streams/piping/flow-control.dedicatedworker.html
/streams/piping/flow-control.html
/streams/piping/flow-control.serviceworker.https.html
/streams/piping/flow-control.sharedworker.html
|
Chrome (unstable channel)Testing web-platform-tests at revision 5430c5b All results6 tests ran/console/console-timeline-timelineEnd-historical.any.html
/console/console-timeline-timelineEnd-historical.any.worker.html
/streams/piping/flow-control.dedicatedworker.html
/streams/piping/flow-control.html
/streams/piping/flow-control.serviceworker.https.html
/streams/piping/flow-control.sharedworker.html
|
The corresponding spec bug is whatwg/streams#653. @ricea has been meaning to work on that I believe, and we should indeed fix the reference implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the standard is currently written, implementations are not required to pass this test.
I'm planning to make implementations use the queue, but even after the change implementations will be able to take a "reasonable" amount of time to fill the queue, in order to provide freedom to optimise chunk size as implied by
- Otherwise, WritableStreamDefaultWriterGetDesiredSize(writer) may be used to determine the flow rate heuristically, e.g. by delaying reads while it is judged to be "low" compared to the size of chunks that have been typically read.
If you are able to propose better standard language at whatwg/streams#653 that would be really great.
streams/piping/flow-control.js
Outdated
const rs = recordingReadableStream({ | ||
pull(controller) { | ||
controller.enqueue(unreadChunks.shift()); | ||
if (unreadChunks.length === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nit: In stream code we always use { } with if, even single-line.
streams/piping/flow-control.js
Outdated
|
||
const writer = ws.getWriter(); | ||
const firstWritePromise = writer.write('a'); | ||
assert_equals(writer.desiredSize, 2, 'after writing the writer\'s desiredSize must be 3'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"must be 2"
These tests are now available on w3c-test.org |
I addressed the code review comments, so if @ricea is happy with this (and the spec change) we can merge them all together. |
lgtm |
pipeTo
in the reference implementation currently effectively ignores the WritableStream's highWaterMark. Or is that intended behavior?