Hi,
I believe I am not the only one in this....
I have an XPCOM componenent that is instantiated by some Java Script as part of an XUL dialog. One of the dialog button call a method on the XPCOM component that gather some information from a server (some long processing SQL Statements...)
Here's the architecture I think would be easiest for you to implement:
interface myICallback : nsISupports
{
void notifyProgress(in unsigned short progress);
void notifyDone();
};interface myIGetServerData : nsISupports
{
void doSomethingThatTakesForever(in myICallback callback);
};You should implement myICallback as a javascript object on your dialog. Then you call into your XPCOM component using the "doSomethingThatTakesForever" method. This method sets up a worker thread to do the task, creates a thread-proxy object which wraps your myICallback, and *returns immediately*.
See nsIProxyObjectManager http://lxr.mozilla.org/mozilla/source/xpcom/proxy/public/nsIProxyObjectManager.idl
for stuff about thread-proxy objects. You will need to get the eventqueue from the main thread to pass to the getProxyForObject method.
Now, you do your long-running SQL query on the worker thread. When you want to update the dialog progress display, you call your thread-proxy, which proxies your progress call back to the main thread.
When your SQL method is done, it calls the "notifyDone" method on the proxy. This method should be more complicated and actually return real data.
--BDS _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
