Bug 150835 - [Streams API] Vended promise capabilities should not need @resolve/@reject fields
Summary: [Streams API] Vended promise capabilities should not need @resolve/@reject fi...
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: youenn fablet
URL:
Keywords:
Depends on: 150627
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-03 03:14 PST by youenn fablet
Modified: 2015-11-03 10:30 PST (History)
4 users (show)

See Also:


Attachments
Patch (4.41 KB, patch)
2015-11-03 03:21 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2015-11-03 03:14:03 PST
Following on bug 150627, vended promise capabilities in the streams API should not need @resolve/@reject fields.
I also suspect we could do clean-up as well in the promise implementation, as a GC-friendly step.
Comment 1 youenn fablet 2015-11-03 03:21:27 PST
Created attachment 264683 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 2015-11-03 06:35:16 PST
Comment on attachment 264683 [details]
Patch

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

> Source/WebCore/Modules/streams/WritableStreamInternals.js:52
> +    const shouldApplyBackpressure = stream.@queue.size > stream.@strategy.highWaterMark;
> +    if (shouldApplyBackpressure && stream.@state === @streamWritable) {
>          stream.@state = @streamWaiting;
>          stream.@readyPromiseCapability = @newPromiseCapability(Promise);
> -    } else {
> +    }
> +    if (!shouldApplyBackpressure && stream.@state === @streamWaiting) {

I personally dislike this option. I think it was better to use the functions to create the vended promises because we are closer to the spec and it is less error prone in case we have to change anything. Instead of this patch I would have functions to create vended promise capabilities as I did in earlier versions of patch for bug 150627.
Comment 3 youenn fablet 2015-11-03 06:57:48 PST
(In reply to comment #2)
> Comment on attachment 264683 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=264683&action=review
> 
> > Source/WebCore/Modules/streams/WritableStreamInternals.js:52
> > +    const shouldApplyBackpressure = stream.@queue.size > stream.@strategy.highWaterMark;
> > +    if (shouldApplyBackpressure && stream.@state === @streamWritable) {
> >          stream.@state = @streamWaiting;
> >          stream.@readyPromiseCapability = @newPromiseCapability(Promise);
> > -    } else {
> > +    }
> > +    if (!shouldApplyBackpressure && stream.@state === @streamWaiting) {
> 
> I personally dislike this option. I think it was better to use the functions
> to create the vended promises because we are closer to the spec and it is
> less error prone in case we have to change anything. Instead of this patch I
> would have functions to create vended promise capabilities as I did in
> earlier versions of patch for bug 150627.

These specific changes make the implementation closer to the spec and removes the fact that we were resolving an already resolved promise.

These changes should be done no matter whether we remove @resolve/@reject for vended promises.
Comment 4 Xabier Rodríguez Calvar 2015-11-03 08:45:08 PST
(In reply to comment #3)
> These specific changes make the implementation closer to the spec and
> removes the fact that we were resolving an already resolved promise.
> 
> These changes should be done no matter whether we remove @resolve/@reject
> for vended promises.

You're right. I missed that from the spec that it was causing that the promises were vended more than once.
Comment 5 WebKit Commit Bot 2015-11-03 10:30:52 PST
Comment on attachment 264683 [details]
Patch

Clearing flags on attachment: 264683

Committed r191956: <http://trac.webkit.org/changeset/191956>
Comment 6 WebKit Commit Bot 2015-11-03 10:30:56 PST
All reviewed patches have been landed.  Closing bug.