MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Compare Revisions

nsISupports proxies

Change Revisions

Revision 58607:

Revision 58607 by pospec4444 on

Revision 58608:

Revision 58608 by pospec4444 on

Title:
nsISupports proxies
nsISupports proxies
Slug:
nsISupports_proxies
nsISupports_proxies
Tags:
NeedsHelp, XPCOM, NeedsUpdate, Obsolete
NeedsHelp, XPCOM, NeedsUpdate, Obsolete
Content:

Revision 58607
Revision 58608
n89      nsresult rv = NS_OK;n89nsresult rv = NS_OK;
n91        nsCOMPtr<nsiproxyobjectmanager> pIProxyObjectManagen91nsCOMPtr<nsiproxyobjectmanager> pIProxyObjectManager(do_Get
>r(do_GetService("@mozilla.org/xpcomproxy;1", &rv));>Service("@mozilla.org/xpcomproxy;1", &rv));
92        if(NS_FAILED(rv)) return rv;92if(NS_FAILED(rv)) return rv;
n94        nsCOMPtr<ifoo> pTestObj(do_CreateInstance(FOO_CONTRn94nsCOMPtr<ifoo> pTestObj(do_CreateInstance(FOO_CONTRACTID, &
>ACTID, &rv));>amp;rv));
95        if(NS_FAILED(rv)) return rv;95if(NS_FAILED(rv)) return rv;
n97        nsCOMPtr<iformfiller> pProxy;n97nsCOMPtr<iformfiller> pProxy;
98        rv = pIProxyObjectManager->GetProxyForObject(NS_PROXY_98rv = pIProxyObjectManager->GetProxyForObject(NS_PROXY_TO_MAIN_
>TO_MAIN_THREAD,>THREAD,
99                IFoo::GetIID(),99        IFoo::GetIID(),
100                pTestObj,100        pTestObj,
101                NS_PROXY_SYNC | NS_PROXY_ALWAYS,101        NS_PROXY_SYNC | NS_PROXY_ALWAYS,
102                getter_AddRefs(pProxy));102        getter_AddRefs(pProxy));
103        if(NS_FAILED(rv)) return rv;103if(NS_FAILED(rv)) return rv;
n105        // we do not care about the real object anymore.n105// we do not care about the real object anymore.
106        // ie. GetProxyObject refcounts it.106// ie. GetProxyObject refcounts it.
107        NS_RELEASE(pTestObj);107NS_RELEASE(pTestObj);
t109        pProxy->Bar();t109pProxy->Bar();
110        NS_RELEASE(pProxy);110NS_RELEASE(pProxy);

Back to History