Re: [whatwg/streams] make TransformStream respect backpressure (#550)

tyoshino commented on this pull request.

Thank you. It's great to make the desiredSize info exposed. But which of #330 do you intend to address?

The OP has been addressed by 5a2753464bd6e34e3bc7a57fcaac24ea5153fbb6. Addition of desiredSize partially fixes the issue explained in the second comment.

>      assert(this._writableController !== undefined);
     assert(this._readableController !== undefined);
 
+    const desiredSize = this._readableController.desiredSize;
+    TransformStreamSetBackpressure(this, desiredSize <= 0);

desiredSize value alone shouldn't be handled as backpressure signal. It's additional info about backpressure. As you see from https://streams.spec.whatwg.org/#readable-stream-default-controller-should-call-pull, pull() is invoked even when the desiredSize is 0 when there are active read()s.

Could you please keep depending on pull() invocation?

> @@ -262,12 +238,32 @@ class TransformStreamSource {
 
     transformStream._readableController = c;
 
-    return this._startPromise;
+    // delay the first source.pull call until there is backpressure
+    return this._startPromise.then(() => {

this then() should live in the constructor of the TransformStream as its only dependency is the TransformStream.

-- 
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/550#pullrequestreview-5802603

Received on Wednesday, 26 October 2016 08:23:06 UTC