diff --git a/xpcom/proxy/public/Makefile.in b/xpcom/proxy/public/Makefile.in index 037f23f55116..88ad20640b71 100644 --- a/xpcom/proxy/public/Makefile.in +++ b/xpcom/proxy/public/Makefile.in @@ -14,20 +14,25 @@ # Copyright (C) 1998 Netscape Communications Corporation. All Rights # Reserved. -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = xpcom +MODULE = xpcom -EXPORTS = nsProxyEvent.h \ - nsProxyObjectManager.h\ - $(NULL) +XPIDL_MODULE = proxyObjInst +XPIDLSRCS = \ + .\nsIProxyCreateInstance.idl \ + $(NULL) -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) +EXPORTS = nsProxyEvent.h \ + nsProxyObjectManager.h\ + $(NULL) + +EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) include $(topsrcdir)/config/config.mk diff --git a/xpcom/proxy/public/makefile.win b/xpcom/proxy/public/makefile.win index 73052575cbf7..34bbca092810 100644 --- a/xpcom/proxy/public/makefile.win +++ b/xpcom/proxy/public/makefile.win @@ -26,4 +26,9 @@ EXPORTS = \ nsProxyObjectManager.h \ $(NULL) +XPIDL_MODULE = proxyObjInst +XPIDLSRCS = \ + .\nsIProxyCreateInstance.idl \ + $(NULL) + include <$(DEPTH)\config\rules.mak> diff --git a/xpcom/proxy/src/idl/nsIProxyCreateInstance.idl b/xpcom/proxy/public/nsIProxyCreateInstance.idl similarity index 100% rename from xpcom/proxy/src/idl/nsIProxyCreateInstance.idl rename to xpcom/proxy/public/nsIProxyCreateInstance.idl diff --git a/xpcom/proxy/src/idl/mk.bat b/xpcom/proxy/src/idl/mk.bat deleted file mode 100755 index e3e1e7d7d601..000000000000 --- a/xpcom/proxy/src/idl/mk.bat +++ /dev/null @@ -1,6 +0,0 @@ -xpidl -w -I ../../../../js/src/xpconnect/idl/ -m header nsIProxyCreateInstance.idl -xpidl -w -I ../../../../js/src/xpconnect/idl/ -m typelib nsIProxyCreateInstance.idl - -cp nsIProxyCreateInstance.xpt ../../../../dist/win32_d.obj/bin/components -cp nsIProxyCreateInstance.h ../ - diff --git a/xpcom/proxy/src/nsProxyObjectManager.cpp b/xpcom/proxy/src/nsProxyObjectManager.cpp index 2135225c9b05..652262f77bd9 100644 --- a/xpcom/proxy/src/nsProxyObjectManager.cpp +++ b/xpcom/proxy/src/nsProxyObjectManager.cpp @@ -168,6 +168,19 @@ nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue, REFNSIID aIID, ns return NS_ERROR_UNEXPECTED; } + // check to see if the eventQ is on our thread. If so, just return the real object. + + if (postQ != nsnull && proxyType != PROXY_ASYNC) + { + PRBool aResult; + postQ->IsQueueOnCurrentThread(&aResult); + + if (aResult) + { + return aObj->QueryInterface(aIID, aProxyObject); + } + } + // check to see if proxy is there or not. *aProxyObject = nsProxyEventObject::GetNewOrUsedProxy(postQ, proxyType, aObj, aIID); if (*aProxyObject != nsnull) @@ -217,8 +230,9 @@ nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue, // 3. Delete the create instance proxy and its real object. - delete ciObject; NS_RELEASE(ciProxy); + delete ciObject; + ciObject = nsnull; // 4. Check to see if creating the requested instance failed. diff --git a/xpcom/proxy/tests/proxytests.cpp b/xpcom/proxy/tests/proxytests.cpp index bb69a1ff4f62..3c0ce8f03874 100644 --- a/xpcom/proxy/tests/proxytests.cpp +++ b/xpcom/proxy/tests/proxytests.cpp @@ -354,6 +354,34 @@ static void PR_CALLBACK EventLoop( void *arg ) rv = eventQ->QueryInterface(nsIEventQueue::GetIID(), (void**)&gEventQueue); if (NS_FAILED(rv)) return; + + printf("Verifing calling Proxy on eventQ thread.\n"); + + nsIProxyObjectManager* manager; + + nsServiceManager::GetService( NS_XPCOMPROXY_PROGID, + kProxyObjectManagerIID, + (nsISupports **)&manager); + + PR_ASSERT(manager); + + nsITestProxy *proxyObject; + nsTestXPCFoo* foo = new nsTestXPCFoo(); + + PR_ASSERT(foo); + + manager->GetProxyObject(gEventQueue, nsITestProxy::GetIID(), foo, PROXY_SYNC, (void**)&proxyObject); + + PRInt32 a; + proxyObject->Test(1, 2, &a); + proxyObject->Test2(); + + delete foo; + NS_RELEASE(proxyObject); + + printf("End of Verification calling Proxy on eventQ thread.\n"); + + printf("Looping for events.\n"); PLEvent* event = nsnull;