- From: Takeshi Yoshino <notifications@github.com>
- Date: Wed, 01 Jul 2015 00:29:00 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/pull/361/r33654433@github.com>
> + const stream = controller._controlledReadableByteStream;
> +
> + if (typeof pullIntoFunction !== 'function') {
> + DestroyReadableByteStreamController(controller);
> + ErrorReadableByteStream(stream, new TypeError('pullInto property of an underlying byte source must be a function'));
> + return;
> + }
> +
> + assert(controller._pendingPullIntos.length > 0);
> + const pullIntoDescriptor = controller._pendingPullIntos[0];
> +
> + controller._callPullOrPullIntoLaterIfNeeded = false;
> + controller._insideUnderlyingByteSource = true;
> +
> + try {
> + pullIntoFunction.apply(source, [pullIntoDescriptor.buffer,
It's (buffer, offsetToWriteAt, sizeAllowedToWrite). The buffer we received from the consumer is `byteLength` long. It's already filled for `bytesFilled` bytes. So, byteLength - bytesFilled bytes are available for writing.
I'm fine with changing this to Uint8Array. I kept this ArrayBufferView free since it seems a little complex interface is acceptable for the controller. But yeah, I realized that this is just inconsistent with enqueue() which accepts ArrayBufferViews.
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/361/files#r33654433
Received on Wednesday, 1 July 2015 07:29:31 UTC