Hi all,

Can ResourceStores be shared among workers?

I have a main script which stores information into a ResourceStore for
temporary storage.  Later, I want to use a worker to access that entry
in the ResourceStore in order to upload it to a remote server.  When a
worker attempts to retrieve the data from the ResourceStore, it is
unable to access that information.  More specifically, the code that
I'm using looks as follows (I've redacted a bunch of error checking to
make it more manageable).

(main program)
localServer = google.gears.factory.create('beta.localserver');
store = localServer.createStore('tester');
store.captureBlob(blob, previewUrl);

(then later in the worker process)
localServer = google.gears.factory.create('beta.localserver');
store = localServer.createStore('tester');
blob = store.getAsBlob(previewUrl);

The worker process' call to store.getAsBlob always throws an
exception.

When the identical functions are called from within one javascript
program (i.e., without any workerpool usage), it works as expected.
In addition, debugging shows that the value of 'previewUrl' has the
same value in the main process and the worker process.  So, I'm fairly
confident that this issue is directly related to the Store itself.

For what it's worth, I also tried passing the store itself from the
main program to the worker program in a message.  However, Firefox
threw an error saying that the Gears module could not be marshaled.

Is there a way for workers and the main program to share information
within a ResourceStore?

Thanks
Dave Viner

Reply via email to