This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Now readExact() and read() are separate. It looks we should do further refactoring to remove size (actually meant maxSize) argument from read() and introduce pullAmount attribute instead. NOTE: This name (pullAmount) is chosen rather than "bufferSize" since it can have misleading message that we can control implementation detail of the producer. We supposed that most people don't want to manually control pull amount but just want to use default value. So, the pulling amount parameter should be provided as an attribute.
Since we cannot install a hook which is invoked right after fulfill callback is run, a user cannot decrease pullAmount on completion of one read(). pullAmount = 1024 ... readPromise is fulfilled with 512 bytes Fulfill callback is run asynchronously Inside fulfill callback we run this pullAmount = 512 But at this point, underlying IO may be already instructed to fetch 1024 bytes of data. We should enable gradual decrease of pullAmount?
(In reply to Takeshi Yoshino from comment #1) > Since we cannot install a hook which is invoked right after fulfill callback > is run, a user cannot decrease pullAmount on completion of one read(). > > pullAmount = 1024 > ... > readPromise is fulfilled with 512 bytes > Fulfill callback is run asynchronously > Inside fulfill callback we run this > pullAmount = 512 > But at this point, underlying IO may be already instructed to fetch 1024 > bytes of data. > > We should enable gradual decrease of pullAmount? Until next read() call, the number of bytes used for fulfilling the last read() call should occupy the pullAmount.
(In reply to Takeshi Yoshino from comment #2) > Until next read() call, the number of bytes used for fulfilling the last > read() call should occupy the pullAmount. Done in preview ver. bytesBeingOutpu does it. https://dvcs.w3.org/hg/streams-api/raw-file/tip/preview.html
Should pullAmount reset bytesBeingOutput?
Preview ver merged into ED. Closing this bug. (In reply to Takeshi Yoshino from comment #4) > Should pullAmount reset bytesBeingOutput? This is put into a separate bug entry. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24008