Bug 113571

Summary: Implement DOMFutures
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: abarth, annevk, buildbot, dglazkov, domenic, ericbidelman, esprehn+autocc, gyuyoung.kim, kenneth, laszlo.gombos, mounir, ojan.autocc, peter, peter+ews, pivisko, rakuco, rego+ews, rniwa, syoichi, webkit.bugzilla, webkit-ews, webkit.review.bot, xan.lopez
Priority: P2 Keywords: WebExposed
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://dom.spec.whatwg.org/#futures
Attachments:
Description Flags
WIP Patch
peter+ews: commit-queue-
WIP Patch
none
WIP Patch none

Description Chris Dumez 2013-03-29 05:41:18 PDT
DOM 4 is introducing Futures, which offers a nicer way to build asynchronous APIs.
Futures provide a convenient way to get access to the result of an operation.

More details at: http://dom.spec.whatwg.org/#futures

It would be nice to implement them in WebKit.
Comment 1 Chris Dumez 2013-03-29 16:11:13 PDT
Created attachment 195814 [details]
WIP Patch
Comment 2 Peter Beverloo (cr-android ews) 2013-03-29 16:28:28 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass cr-android-ews (chromium-android):
Output: http://webkit-commit-queue.appspot.com/results/17255654
Comment 3 Early Warning System Bot 2013-03-29 16:29:17 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass qt-ews (qt):
Output: http://webkit-commit-queue.appspot.com/results/17311746
Comment 4 WebKit Review Bot 2013-03-29 16:49:36 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://webkit-commit-queue.appspot.com/results/17257696
Comment 5 Build Bot 2013-03-29 16:56:15 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-commit-queue.appspot.com/results/17327415
Comment 6 WebKit Review Bot 2013-03-29 16:58:24 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass cr-linux-debug-ews (chromium-xvfb):
Output: http://webkit-commit-queue.appspot.com/results/17356136
Comment 7 Build Bot 2013-03-29 17:15:17 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass mac-ews (mac):
Output: http://webkit-commit-queue.appspot.com/results/17327421
Comment 8 Build Bot 2013-03-29 17:56:52 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass mac-ews (mac):
Output: http://webkit-commit-queue.appspot.com/results/17330451
Comment 9 Early Warning System Bot 2013-03-30 02:39:11 PDT
Comment on attachment 195814 [details]
WIP Patch

Attachment 195814 [details] did not pass qt-wk2-ews (qt):
Output: http://webkit-commit-queue.appspot.com/results/17332298
Comment 10 Chris Dumez 2013-03-30 10:39:31 PDT
Created attachment 195860 [details]
WIP Patch
Comment 11 Adam Barth 2013-03-30 10:43:57 PDT
I would like to review this patch before it lands.
Comment 12 Chris Dumez 2013-03-30 11:07:43 PDT
(In reply to comment #11)
> I would like to review this patch before it lands.

Sure. Is it better to send an email to webkit-dev as well to announce that I'm working on this?
Comment 13 Adam Barth 2013-03-30 11:49:23 PDT
> Sure. Is it better to send an email to webkit-dev as well to announce that I'm working on this?

That might be worthwhile.  I'm more interested in the technical aspects of the patch (e.g., the usage of ScriptValue).  It looks like your work is still in progress, so it didn't seem appropriate to review the current patch.
Comment 14 Chris Dumez 2013-03-30 12:54:20 PDT
(In reply to comment #13)
> > Sure. Is it better to send an email to webkit-dev as well to announce that I'm working on this?
> 
> That might be worthwhile.  I'm more interested in the technical aspects of the patch (e.g., the usage of ScriptValue).  It looks like your work is still in progress, so it didn't seem appropriate to review the current patch.

This is useful feedback, thanks. Could you please explain the issue with using ScriptValue? Is there a better way to represent the WebIDL "any" type? I see that it is used quite a lot in the IndexedDB code, which I used as reference.

I tried compiling the patch for Chromium to see if I was missing something related to V8 but the generic code seems to compile fine as ScriptValue also exists for V8 (although with a different API but it does not matter much for my use).
Comment 15 Adam Barth 2013-03-30 14:16:04 PDT
You almost certainly should not be using ScriptValue.  Essentially any time we use ScriptValue, it's a memory leak.  I'd have to study this feature in more detail to figure out the best way of implementing it.
Comment 16 Chris Dumez 2013-04-01 08:22:24 PDT
Created attachment 195972 [details]
WIP Patch
Comment 17 Chris Dumez 2013-08-01 04:01:17 PDT
Promises should now be implemented, not futures.