On Tue, Jul 14, 2009 at 9:51 PM, pnaha2<[email protected]> wrote:
> Internally to the Workerpool, each Worker has their own message
> queues. When messages are sent by any Worker, they go through the
> PoolThreadManager and are added to the appropriate Worker's queue.
> Then a notification is sent to Worker telling it there's a message. I
> understand the Windows (IE) implementation with posting messages to
> HWNDs, but how does firing notifications to Firefox cause its Worker's
> onmessage function to be invoked? Also, is there no PoolThreadManager
> for Chrome?

Firefox has abstractions for message queues that we use. See
workerpool/firefox/pool_threads_manager.cc -> struct
JavaScriptWorkerInfo::nsIEventQueue. It is conceptually similar to the
mesage-only HWND that we use for IE, but is something that firefox
provides which is cross-platform.

> Is there only one PoolThreadManager per Workerpool?

Yes.

> If there is, what
> prevents multiple Workers from being invoked and calling
> GetPoolMessage simultaneously?

GetPoolMessage() is synchronized with a mutex:
http://code.google.com/p/gears/source/browse/trunk/gears/workerpool/firefox/pool_threads_manager.cc#549

> Also, it appears the Chrome message queue implementation relies on
> Window's HWNDs. How do Chrome/Gears work on other platforms?

This isn't true. Only the Windows implementation of MessageQueue in
Chromium relies on HWND. That said, Gears is not yet implemented on
non-Windows platforms for Chromium.

> There are IPC message queue classes aside from the message queue
> classes that PoolThreadManager uses. I assume these are for inter-
> process communication between Gears and the browser, but if all the
> Workers in the Workerpool and the main application parent thread can
> all communicate via inter-thread message passing, when do Gears/the
> browser have to communicate over process boundaries.

Which files are you referring to? I don't remember any IPC being
involved in the WorkerPool implementation on any browser, but I might
be forgetting.

- a

Reply via email to