- From: Mattias Buelens <notifications@github.com>
- Date: Thu, 25 Mar 2021 16:02:59 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/1114/review/621645629@github.com>
@MattiasBuelens commented on this pull request. > + 1. Return [=a promise resolved with=] undefined. + 1. Let |pull2Algorithm| be the following steps: + 1. If |reading| is true, return [=a promise resolved with=] undefined. + 1. Set |reading| to true. + 1. Let |byobRequest| be ! [$ReadableByteStreamControllerGetBYOBRequest$](|branch2|.[=ReadableStream/[[controller]]=]). + 1. If |byobRequest| is null, + 1. Perform |pullWithDefaultReader|. + 1. Otherwise, + 1. Perform |pullWithBYOBReader|, given |byobRequest|.[=ReadableStreamBYOBRequest/[[view]]=] and true. + 1. Return [=a promise resolved with=] undefined. + 1. Let |cancel1Algorithm| be the following steps, taking a |reason| argument: + 1. Set |canceled1| to true. + 1. Set |reason1| to |reason|. + 1. If |reading| is false and + |branch1|.[=ReadableStream/[[controller]]=].[=ReadableByteStreamController/[[pendingPullIntos]]=] + is not [=list/is empty|empty=], This condition isn't correct yet. I'm still working on it, but I think it will end up being something along these lines: > If _branch1_.\[[controller]].\[[pendingPullIntos]] is not empty and we're currently not pulling with a BYOB reader from _branch1_, ... The idea is that if a branch is canceled and still has a pending BYOB request, but we're not already using that BYOB request to BYOB read from the original stream (and thus we haven't transferred its buffer), then we don't need to wait with responding to this branch's BYOB request. However, if we *are* using this branch's BYOB request for our currently pending BYOB read, then we have transferred control of that request's buffer to the original stream and we must wait for that BYOB read to complete before we can transfer it back to the branch. Hence why we need the second part of the condition. ...Have I already mentioned that this is quite tricky to get right? 😅 -- 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/1114#pullrequestreview-621645629
Received on Thursday, 25 March 2021 23:04:44 UTC