Hey Steven,

ccing the mozilla xpcom newsgroup.  This will help others.

To answer your specific question, there are 2 ways to build a proxy object.  The
first is when you already have the nsISupports object created.  In this case, you
really do not have to have a CID (the given implementation behind the IID is
already created).  For this, you would do something like:

http://lxr.mozilla.org/seamonkey/source/xpcom/base/nsConsoleService.cpp#301

Now, if you want the object to be created on the remote thread, you do something
like this:

http://lxr.mozilla.org/seamonkey/source/xpcom/proxy/tests/proxytests.cpp#337

Note that the parameter are similar to CreateInstance.

Briefly hearing what you are trying to do, I think that you probably need the first
approach.  To get to the UI event queue, I have created a convenient way to specify
the ui event queue.  Just pass this: NS_UI_THREAD_EVENTQ as the first parameter to
either GetProxy* function and the correct event queue will be resolved.

Your call should look similar to this:

GetProxyForObject(NS_UI_THREAD_EVENTQ ,
                                NS_GET_IID(nsIFoo),
                                createdObject,
                                PROXY_SYNC | PROXY_ALWAYS,
                                &theProxy);


createdObject should be an object which implements nsIFoo which you created.

Let me know if this works for you.

Regards,


Steven Katz - Sun Microsystems wrote:

> Hi,
>
> I work on the Java Plugin here at Sun and am trying to use the proxy mechanism
> to call back into the main thread to handle request an applet might make.
>
> So far I have been unable to get the code to even compile.  Do you have a more
> complete example then the one given at:
>
> http://www.mozilla.org/projects/xpcom/Proxies.html
>
> Specifically, there does not appear to be a CID for a ProxyObject as is implied
> in the above example.
>
> thanks,
>
> steven katz

Reply via email to