[webkit-help] Async methods in WebCore
julien.chaffraix at gmail.com
Mon Apr 18 09:05:20 PDT 2011
> an IDL. I have added a new class to WebCore, where I want some of
> the methods in this new class to return immediately, and upon completion I
> would be the best way of doing this in WebCore.
> Can anyone please assist me with this?
There is a couple of areas that uses asynchronous dispatching inside
WebCore. You could mimic what is done in those cases.
One way is to use an EventListener and dispatch a custom Event on your
object with your return value inside. That's what a lot of objects are
using: one simple example would be
Source/WebCore/xml/XMLHttpRequest.idl as there is only few events
(onReadyStateChange or onprogress are the most relevant IMHO) and not
a lot of other code around. The dom/ directory has also a lot of
examples of event dispatching.
The other way is what Geolocation is doing: you register a callback
and manually call it with the right arguments. See
Source/WebCore/page/Geolocation.idl and the bindings side. This will
likely require some custom binding code to check the object passed as
an argument and call the right method.
Hope it helps,
More information about the webkit-help