Bug 147487 - [Streams API] ReadableStreamReader closed promise should use CachedAttribute
Summary: [Streams API] ReadableStreamReader closed promise should use CachedAttribute
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-31 05:16 PDT by youenn fablet
Modified: 2015-08-10 03:01 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.75 KB, patch)
2015-07-31 05:20 PDT, 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-07-31 05:16:53 PDT
This would allow removing the current specific promise attribute binding.
This would allow using a JSC::WriteBarrier in lieu of JSC::Strong as well.
Comment 1 youenn fablet 2015-07-31 05:20:18 PDT
Created attachment 257918 [details]
Patch
Comment 2 youenn fablet 2015-07-31 05:21:15 PDT
(In reply to comment #1)
> Created attachment 257918 [details]
> Patch

This patch does not remove the specific binding generator code related to promise attribute. This would be done as a follow-up patch.
Comment 3 Darin Adler 2015-08-08 17:57:40 PDT
Comment on attachment 257918 [details]
Patch

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

Looks OK. I don’t really know what CachedAttribute does but this looks sensible.

> Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp:51
> +        const_cast<JSReadableStreamReader*>(this)->m_closed.set(exec->vm(), this, closedPromise->promise());

Is this preferred over marking m_closed mutable?
Comment 4 youenn fablet 2015-08-10 02:13:36 PDT
(In reply to comment #3)
> Comment on attachment 257918 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=257918&action=review
> 
> Looks OK. I don’t really know what CachedAttribute does but this looks
> sensible.

CachedAttribute generates some code like:
- a class member field in the JS wrapper class (as would be done in JSC)
- marking the member field when the JS wrapper object is being visited.


In our case, this removes one JSC::Strong.
This does not solve entirely the issue since the promise is strongified when being wrapped as a DeferredWrapper.

> > Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp:51
> > +        const_cast<JSReadableStreamReader*>(this)->m_closed.set(exec->vm(), this, closedPromise->promise());
> 
> Is this preferred over marking m_closed mutable?

Right, marking cached attributes as mutable would be an improvement.
Comment 5 WebKit Commit Bot 2015-08-10 03:01:49 PDT
Comment on attachment 257918 [details]
Patch

Clearing flags on attachment: 257918

Committed r188209: <http://trac.webkit.org/changeset/188209>
Comment 6 WebKit Commit Bot 2015-08-10 03:01:53 PDT
All reviewed patches have been landed.  Closing bug.