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

tyoshino commented on this pull request.



>    }
 
   pull() {
-    this._transformStream._readableBackpressure = false;
-    TransformStreamTransformIfNeeded(this._transformStream);
+    // console.log('TransformStreamSource.pull()');
+
+    const transformStream = this._transformStream;
+    // invariant: pull is never called while readableBackpressure is false.
+    // Enforced by the promises returned by source.start and source.pull.
+    assert(transformStream._readableBackpressure === true);
+    assert(transformStream._backpressureChangePromise !== undefined);
+
+    TransformStreamSetBackpressure(transformStream, false);
+
+    transformStream._backpressureChangePromise.then(backpressure => assert(backpressure === true));
+
+    return transformStream._backpressureChangePromise;

This is looping back the backpressure signal on desiredSize to pull() but mux-ed with backpressure-changing TransformStreamEnqueueToReadable() invocation. I think we shouldn't have to have such a loop back here. Let me think more.

-- 
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-5808031

Received on Wednesday, 26 October 2016 08:28:14 UTC