Bug 142399

Summary: ReadableStream does not not need to pass itself as callback parameter
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, calvaris, cgarcia, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 141160    
Attachments:
Description Flags
Patch
none
Patch for landing none

Description youenn fablet 2015-03-06 09:17:59 PST
The callbacks can directly retrieve it by capturing the JSReadableStream object itself.
Comment 1 youenn fablet 2015-03-06 09:30:06 PST
Created attachment 248070 [details]
Patch
Comment 2 Darin Adler 2015-03-06 15:55:32 PST
Comment on attachment 248070 [details]
Patch

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

> Source/WebCore/bindings/js/JSReadableStreamCustom.cpp:74
> +        wrapper.resolve(&impl());

What guarantees that "this" won’t be deallocated before this function gets called?

> Source/WebCore/bindings/js/JSReadableStreamCustom.cpp:92
> +        wrapper.resolve(&impl());

What guarantees that "this" won’t be deallocated before this function gets called?
Comment 3 youenn fablet 2015-03-09 03:41:13 PDT
Created attachment 248240 [details]
Patch for landing
Comment 4 youenn fablet 2015-03-09 04:20:18 PDT
(In reply to comment #2)
> Comment on attachment 248070 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=248070&action=review
> 
> > Source/WebCore/bindings/js/JSReadableStreamCustom.cpp:74
> > +        wrapper.resolve(&impl());
> 
> What guarantees that "this" won’t be deallocated before this function gets
> called?
> 
> > Source/WebCore/bindings/js/JSReadableStreamCustom.cpp:92
> > +        wrapper.resolve(&impl());
> 
> What guarantees that "this" won’t be deallocated before this function gets
> called?

Good point.
It is not implemented yet.
Plan is to use ActiveDOMObject from which ReadableStream is deriving.
I filed bug 142478 for that purpose.
Comment 5 WebKit Commit Bot 2015-03-09 04:32:16 PDT
Comment on attachment 248240 [details]
Patch for landing

Clearing flags on attachment: 248240

Committed r181262: <http://trac.webkit.org/changeset/181262>
Comment 6 WebKit Commit Bot 2015-03-09 04:32:19 PDT
All reviewed patches have been landed.  Closing bug.