Bug 169759 - [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (readable stream state)
Summary: [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (readabl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Romain Bellessort
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-16 09:59 PDT by Romain Bellessort
Modified: 2017-03-23 02:00 PDT (History)
5 users (show)

See Also:


Attachments
Patch (16.20 KB, patch)
2017-03-16 10:36 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews117 for mac-elcapitan (368.92 KB, application/zip)
2017-03-16 11:37 PDT, Build Bot
no flags Details
Patch (16.87 KB, patch)
2017-03-17 03:15 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff
Patch (20.33 KB, patch)
2017-03-22 07:17 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Bellessort 2017-03-16 09:59:38 PDT
Implement respond() in readable stream state
Comment 1 Romain Bellessort 2017-03-16 10:36:19 PDT
Created attachment 304655 [details]
Patch
Comment 2 Build Bot 2017-03-16 11:37:25 PDT
Comment on attachment 304655 [details]
Patch

Attachment 304655 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3339459

Number of test failures exceeded the failure limit.
Comment 3 Build Bot 2017-03-16 11:37:28 PDT
Created attachment 304659 [details]
Archive of layout-test-results from ews117 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 Romain Bellessort 2017-03-17 03:15:03 PDT
Created attachment 304769 [details]
Patch
Comment 5 youenn fablet 2017-03-17 08:35:13 PDT
Comment on attachment 304769 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304769&action=review

> Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:388
> +    return srcBuffer.slice(srcByteOffset, srcByteOffset + srcLength);

This implementation is not shielded.
Also it should probably be implemented in JSC directly.
There is already @structuredCloneArrayBuffer. Maybe we should group these together.

> Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:417
> +    @readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);

The function names are starting to be very long.
Although it is good to match spec names, this hurts readability.
Maybe we could start some shortening like:
readableByteStreamControllerEnqueueChunkToQueue -> readableByteStreamControllerEnqueueChunk
readableByteStreamControllerCommitPullIntoDescriptor -> readableByteStreamControllerCommitDescriptor
readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue -> readableByteStreamControllerProcessPullDescriptors
...

> Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:450
> +            @readableByteStreamControllerShiftPendingPullInto(controller);

The naming seems not totally consistent here:
readableByteStreamControllerShiftPendingPullInto
readableByteStreamControllerCommitPullIntoDescriptor

I would rename to something like readableByteStreamControllerShiftPendingDescriptor, readableByteStreamControllerCommitDescriptor

> Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:503
> +{

Group this function with the other, in a new or another file ideally.
Comment 6 Romain Bellessort 2017-03-22 07:17:37 PDT
Created attachment 305095 [details]
Patch
Comment 7 WebKit Commit Bot 2017-03-22 11:07:53 PDT
Comment on attachment 305095 [details]
Patch

Clearing flags on attachment: 305095

Committed r214265: <http://trac.webkit.org/changeset/214265>
Comment 8 WebKit Commit Bot 2017-03-22 11:07:57 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Romain Bellessort 2017-03-23 02:00:38 PDT
(In reply to youenn fablet from comment #5)
> Comment on attachment 304769 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=304769&action=review
> 
> > Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:388
> > +    return srcBuffer.slice(srcByteOffset, srcByteOffset + srcLength);
> 
> This implementation is not shielded.
> Also it should probably be implemented in JSC directly.
> There is already @structuredCloneArrayBuffer. Maybe we should group these
> together.

Ok I will see how to group them together.

> > Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:417
> > +    @readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
> 
> The function names are starting to be very long.
> Although it is good to match spec names, this hurts readability.
> Maybe we could start some shortening like:
> readableByteStreamControllerEnqueueChunkToQueue ->
> readableByteStreamControllerEnqueueChunk
> readableByteStreamControllerCommitPullIntoDescriptor ->
> readableByteStreamControllerCommitDescriptor
> readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue ->
> readableByteStreamControllerProcessPullDescriptors
> ...
> 
> > Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:450
> > +            @readableByteStreamControllerShiftPendingPullInto(controller);
> 
> The naming seems not totally consistent here:
> readableByteStreamControllerShiftPendingPullInto
> readableByteStreamControllerCommitPullIntoDescriptor
> 
> I would rename to something like
> readableByteStreamControllerShiftPendingDescriptor,
> readableByteStreamControllerCommitDescriptor
> 

I've updated these names as well as a few other (and I've added comments to indicate the name of corresponding operation in the spec).

> > Source/WebCore/Modules/streams/ReadableByteStreamInternals.js:503
> > +{
> 
> Group this function with the other, in a new or another file ideally.

As this function is called only once by the spec and simply copies data from one buffer to another (no need to detach/transfer/...), I've inlined it.