Whats the deal with isolates and worker on the client side?

57 views
Skip to first unread message

jako

unread,
May 19, 2012, 5:01:20 PM5/19/12
to General Dart Discussion
I played around quite some time now with isolates and webworker in
dart and Im not shure where this all is going.
On one side we can spawn dom isolates from an url, which are like
workers in an Iframe which is fine.

On the other hand we can spawn isolates from a function, you can send
objects directly to them (its buggy at the moment but already filed a
bug)
http://www.dartlang.org/docs/library-tour/#sending-any-type-of-object
... but they dont have access to the dom.
Thats a bit puzzling and I tell you why... so isolates are not like
workers they are light and they could run on the same process, but
they also could run on their own process like a worker.

So because it is possible that they run like workers, they dont have
access to the dom.. right? Then tell me why they dont have access to
the dom functions they could access, either as worker or if they run
on the dom process?
https://developer.mozilla.org/en/DOM/Worker/Functions_available_to_workers

You could tell me now that I maybe should use domisolates spawned from
an url, but then I would lose the ability to send any kind of object
to that isolates.

Anton Muhin

unread,
May 21, 2012, 6:31:55 AM5/21/12
to jako, General Dart Discussion
Jako,

may you go into more details about what you expect?

yours,
anton.

jako

unread,
May 21, 2012, 9:47:54 AM5/21/12
to General Dart Discussion
Shure,

What I would like to do with isolates on the client side are
XMLHttpRequest for example to Request files from a server and to
diggest these received data on that isolate, and send it to the
domisolate when its ready.
Also, with workers you can post typed arrays without the downside that
it gets serialized to json (See: http://updates.html5rocks.com/2011/09/Workers-ArrayBuffer)

What I would like on the clientside when I use spawnFunction(void
topLevelFunction()) to spawn an isolate, is some sort of shared API
from the dom, which offers some of the classes/functions that are
shared among workers and the domisolates...
http://www.w3.org/TR/workers/#apis-available-to-workers


On 21 Mai, 12:31, Anton Muhin <ant...@google.com> wrote:
> Jako,
>
> may you go into more details about what you expect?
>
> yours,
> anton.
>
>
>
>
>
>
>
> On Sun, May 20, 2012 at 1:01 AM, jako <p4j...@googlemail.com> wrote:
> > I played around quite some time now with isolates and webworker in
> > dart and Im not shure where this all is going.
> > On one side we can spawn dom isolates from an url, which are like
> > workers in an Iframe which is fine.
>
> > On the other hand we can spawn isolates from a function, you can send
> > objects directly to them (its buggy at the moment but already filed a
> > bug)
> >http://www.dartlang.org/docs/library-tour/#sending-any-type-of-object
> > ... but they dont have access to the dom.
> > Thats a bit puzzling and I tell you why... so isolates are not like
> > workers they are light and they could run on the same process, but
> > they also could run on their own process like a worker.
>
> > So because it is possible that they run like workers, they dont have
> > access to the dom.. right? Then tell me why they dont have access to
> > the dom functions they could access, either as worker or if they run
> > on the dom process?
> >https://developer.mozilla.org/en/DOM/Worker/Functions_available_to_wo...

Anton Muhin

unread,
Jun 19, 2012, 3:33:05 PM6/19/12
to jako, General Dart Discussion
p4jako,

sorry for a late response.

As of now, to get access to Worker API, one should spawn a proper worker.

We're working actively on unifying API across stacks, so we hope
eventually to have a better story for pure Dart isolates.

yours,
anton.

Peter Jakobs

unread,
Jun 19, 2012, 4:08:10 PM6/19/12
to General Dart Discussion
Im looking forward to it, isolates is one of the most interesting
feature in dart, in my opinion.

I hope you make some progress on sending any kind of object to
isolates.. actually will this then be possible with dart2js compiled
code too?

Anton Muhin

unread,
Jun 21, 2012, 10:12:58 AM6/21/12
to Peter Jakobs, General Dart Discussion, Sigmund Cherem, Vijay Menon
Adding some other people.

I think there is a plan to support sending all the kind of objects
across isolates, but be warned: you can by mistake send too much if
your object references huge object graph.

I personally think that sending some set of primitive values like
strings, ints and alike leads to better protocols between isolates.

yours,
anton.

John Evans

unread,
Jun 21, 2012, 12:10:45 PM6/21/12
to mi...@dartlang.org
+1 to this post.

I see lots of places in my projects to use isolates, and am looking forward to the maturation of the API; particularly on client-side.
Reply all
Reply to author
Forward
0 new messages