Thursday, July 17, 2014

GWT and web workers

I've tried to implement support for html5 dedicated web workers in gwt and got some problems: here is an overview of them.

I've used some other projects for inspiration: worker part from speedtracer and gwt-ns. Both implementation doesn't work with latest GWT 2.5/2.6 releases.

As gwt-ns looks like enhanced version of speedtracer workers I've used gwt-ns as the base.

Some of requirements for worker implementation in gwt:
1) use native dedicated workers in modern browsers / emulated ones in old browsers
2) debug workers (in our company we are using hosted devmode)
3) test workers in java environment
4) minimal overhead in modern browsers 

As in gwt-ns I used solution with deferred binding that can expand into two variants:
1) new Worker("worker.js")
2) new EmulatedWorker(new WorkerEntryPoint())

In second case we need to have dependency on WorkerEntryPoint from client module (here and below there are two modules: client and worker).
But in case if client module inherits worker module we also got worker dedicated linker for client module and WorkerEntryPoint which doesn't have any sense in context of client module.

So temporarily we are using next workaround: 
there are two modules for workers: WorkerClasses (sources + dependencies) and Worker (inherits WorkerClasses, define entry point, define properties for getting only one permutation in result).
Any ways to do this better?

In case of native worker implementation firstly we load worker.nocache.js and after nocache file loads HASH js file. In gwt-ns special linker for client modules executes worker compilation as subprocess and replace worker.js names to HASH js name. They replacing js content in linker (here). 
Any ways to do this in modern gwt linkers api?

Also if I will decide to use super devmode - what should I do in worker linker to support source maps?

--
Thanks,
Timur Abishev

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment