added the nsIProxyCreateInstance.idl file to the xpidl auto gen macros. added smarts to proxy object mgr to determine whether or not the proxy obj is on the same thread as the caller (did this checkin for doug)
git-svn-id: svn://10.0.0.236/trunk@36629 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
2929bfb855
commit
8986daacf7
@ -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
|
||||
|
||||
|
||||
@ -26,4 +26,9 @@ EXPORTS = \
|
||||
nsProxyObjectManager.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDL_MODULE = proxyObjInst
|
||||
XPIDLSRCS = \
|
||||
.\nsIProxyCreateInstance.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@ -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 ../
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user