Re: [whatwg/streams] Refactor TransformStream's backpressure handling (#571)

tyoshino commented on this pull request.



> @@ -97,40 +105,51 @@ function TransformStreamErrorInternal(transformStream, e) {
   }
 }
 
-function TransformStreamReadyPromise(transformStream) {
-  assert(transformStream._backpressureChangePromise !== undefined);
+// Used for preventing the next write() call on TransformStreamSink until there
+// is no longer backpressure.
+function TransformStreamBackpressureGonePromise(transformStream) {

OK. How about ReadableReadyPromise?

> @@ -363,14 +386,18 @@ module.exports = class TransformStream {
 
     this._readable = new ReadableStream(source, transformer.readableStrategy);
 
-    const sink = new TransformStreamSink(this, startPromise);
+    const sink = new TransformStreamSink(this, startPromise.then(() => {
+      return TransformStreamBackpressureGonePromise(this);
+    }));

OK. Reverted

>  
     this._writable = new WritableStream(sink, transformer.writableStrategy);
 
     assert(this._writableController !== undefined);
     assert(this._readableController !== undefined);
 
     const desiredSize = this._readableController.desiredSize;
+    // Tentatively set _backpressure based on desiredSize. When desiredSize is 0, it's possible that a pull() is made
+    // immediately after this because of pending read()s and fix _backpressure back to false.

Oops, yeah, this is not right for here. Fixed.

-- 
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/571

Received on Friday, 28 October 2016 04:19:08 UTC