Re: [whatwg/streams] Add WritableStreamDefaultController.releaseBackpressure() (PR #1190)

@domenic commented on this pull request.



> @@ -1150,8 +1150,8 @@ interface ReadableStreamDefaultReader {
 ReadableStreamDefaultReader includes ReadableStreamGenericReader;
 
 dictionary ReadableStreamDefaultReadResult {
- any value;
- boolean done;
+  any value;

Might be worth pulling the Web IDL and editorial changes out into a separate PR that we can just approve and merge ASAP.

> @@ -5147,6 +5179,20 @@ The following abstract operations support the implementation of the
   1. Perform ! [$WritableStreamFinishInFlightWriteWithError$](|stream|, |reason|).
 </div>
 
+<div algorithm>
+ <dfn abstract-op lt="WritableStreamDefaultControllerReleaseBackpressure"
+ id="writable-stream-default-controller-release-backpressure">WritableStreamDefaultControllerReleaseBackpressure(|controller|)</dfn>

No need for custom IDs for new abstract-ops

> @@ -5147,6 +5179,20 @@ The following abstract operations support the implementation of the
   1. Perform ! [$WritableStreamFinishInFlightWriteWithError$](|stream|, |reason|).
 </div>
 
+<div algorithm>
+ <dfn abstract-op lt="WritableStreamDefaultControllerReleaseBackpressure"
+ id="writable-stream-default-controller-release-backpressure">WritableStreamDefaultControllerReleaseBackpressure(|controller|)</dfn>
+ performs the following steps:
+
+ 1. Let |stream| be |controller|.[=WritableStreamDefaultController/[[stream]]=].
+ 1. Assert: |stream|.[=WritableStream/[[state]]=] is "`writable`".
+ 1. Set |controller|.[=WritableStreamDefaultController/[[releaseBackpressure]]=] to true.
+ 1. If ! [$WritableStreamHasOperationMarkedInFlight$](|stream|) is false and
+    [$WritableStreamCloseQueuedOrInFlight$](|stream|) is false,

```suggestion
    ! [$WritableStreamCloseQueuedOrInFlight$](|stream|) is false,
```

> @@ -6850,14 +6900,22 @@ reason.
 <div algorithm="create a TransformStream">
  To <dfn export for="TransformStream" lt="set up|setting up">set up</dfn> a
  newly-[=new|created-via-Web IDL=] {{TransformStream}} |stream| given an algorithm <dfn export
- for="TransformStream/set up"><var>transformAlgorithm</var></dfn> and an optional algorithm <dfn
- export for="TransformStream/set up"><var>flushAlgorithm</var></dfn>, perform the following steps.
+ for="TransformStream/set up"><var>transformAlgorithm</var></dfn>, an optional algorithm <dfn
+ export for="TransformStream/set up"><var>flushAlgorithm</var></dfn>, an optional number <dfn
+ export for="TransformStream/set up"><var>writableHighWaterMark</var></dfn> (default 1), an optional
+ algorithm <dfn export for="TransformStream/set up"><var>writableSizeAlgorithm</var></dfn>, an
+ optional number <dfn export for="TransformStream/set up"><var>readableHighWaterMark</var></dfn>
+ (default 0), and an optional algorithm <dfn export
+ for="TransformStream/set up"><var>readableSizeAlgorithm</var></dfn>, perform the following steps.

We could have separate set up algorithms for sync vs. async transforms, and thus take away the responsibility of picking the right high water mark from the other spec author. So far other specs haven't needed these extra customization points and I think it might be simpler not to give them out.

(On the other hand, the fact that existing byte-stream-transform specs are calculating the size of all chunks as 1 is a bit unfortunate...)

-- 
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/pull/1190#pullrequestreview-820823179

Received on Wednesday, 1 December 2021 21:34:35 UTC