diff --git a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp index 71a00abfe42..2be6c8a7cf6 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -1205,7 +1205,8 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(const nsAString& aImpls) if (!aImpls.IsEmpty()) { // Obtain the interface info manager that can tell us the IID // for a given interface name. - nsCOMPtr infoManager = getter_AddRefs(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + infoManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); if (!infoManager) return NS_ERROR_FAILURE; diff --git a/mozilla/content/xtf/src/nsXTFInterfaceAggregator.cpp b/mozilla/content/xtf/src/nsXTFInterfaceAggregator.cpp index b27578006f1..e16a34a5a65 100644 --- a/mozilla/content/xtf/src/nsXTFInterfaceAggregator.cpp +++ b/mozilla/content/xtf/src/nsXTFInterfaceAggregator.cpp @@ -40,6 +40,7 @@ #include "xptcall.h" #include "nsIInterfaceInfo.h" #include "nsIInterfaceInfoManager.h" +#include "nsServiceManagerUtils.h" #ifdef DEBUG #include #endif @@ -143,8 +144,8 @@ nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP nsXTFInterfaceAggregator::GetInterfaceInfo(nsIInterfaceInfo** info) { - nsCOMPtr iim = - getter_AddRefs(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ASSERTION(iim, "could not get interface info manager"); return iim->GetInfoForIID( &mIID, info); } diff --git a/mozilla/content/xtf/src/nsXTFWeakTearoff.cpp b/mozilla/content/xtf/src/nsXTFWeakTearoff.cpp index 51fb2da6bfc..3a74c74b9b8 100644 --- a/mozilla/content/xtf/src/nsXTFWeakTearoff.cpp +++ b/mozilla/content/xtf/src/nsXTFWeakTearoff.cpp @@ -40,6 +40,7 @@ #include "xptcall.h" #include "nsIInterfaceInfo.h" #include "nsIInterfaceInfoManager.h" +#include "nsServiceManagerUtils.h" #ifdef DEBUG #include #endif @@ -137,8 +138,8 @@ nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP nsXTFWeakTearoff::GetInterfaceInfo(nsIInterfaceInfo** info) { - nsCOMPtr iim = - getter_AddRefs(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ASSERTION(iim, "could not get interface info manager"); return iim->GetInfoForIID( &mIID, info); } diff --git a/mozilla/dom/src/base/nsDOMClassInfo.cpp b/mozilla/dom/src/base/nsDOMClassInfo.cpp index c3b73614b11..396e361b195 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.cpp +++ b/mozilla/dom/src/base/nsDOMClassInfo.cpp @@ -1464,8 +1464,8 @@ nsDOMClassInfo::RegisterClassProtos(PRInt32 aClassInfoID) return NS_OK; } - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE); nsCOMPtr if_info; @@ -3170,8 +3170,8 @@ nsDOMClassInfo::PostCreate(nsIXPConnectWrappedNative *wrapper, #ifdef DEBUG if (mData->mHasClassInterface) { - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); if (iim) { nsCOMPtr if_info; @@ -4401,8 +4401,8 @@ BaseStubConstructor(const nsGlobalNameStruct *name_struct, JSContext *cx, static nsresult DefineInterfaceConstants(JSContext *cx, JSObject *obj, const nsIID *aIID) { - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED); nsCOMPtr if_info; @@ -4657,8 +4657,8 @@ DOMJSClass_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp) ci_data = name_struct->mData; } - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); if (!iim) { NS_ERROR("DOMJSClass_HasInstance can't get interface info mgr."); nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED); @@ -5288,8 +5288,8 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, NS_ENSURE_SUCCESS(rv, rv); } - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE); nsCOMPtr if_info; @@ -8989,8 +8989,8 @@ nsHTMLPluginObjElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSString *str = JSVAL_TO_STRING(id); char* cstring = ::JS_GetStringBytes(str); - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED); nsIID* iid = nsnull; diff --git a/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp b/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp index fdef74949d2..d3c4e75cf2a 100644 --- a/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp +++ b/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp @@ -291,8 +291,8 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager, nsresult nsScriptNameSpaceManager::FillHashWithDOMInterfaces() { - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED); // First look for all interfaces whose name starts with nsIDOM @@ -349,8 +349,8 @@ nsScriptNameSpaceManager::RegisterExternalInterfaces(PRBool aAsProto) do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE); nsCOMPtr enumerator; diff --git a/mozilla/extensions/webservices/interfaceinfo/src/nsScriptableInterfaceInfo.cpp b/mozilla/extensions/webservices/interfaceinfo/src/nsScriptableInterfaceInfo.cpp index 83b4f9eb752..548793c85cb 100644 --- a/mozilla/extensions/webservices/interfaceinfo/src/nsScriptableInterfaceInfo.cpp +++ b/mozilla/extensions/webservices/interfaceinfo/src/nsScriptableInterfaceInfo.cpp @@ -39,6 +39,7 @@ /* nsIScriptableInteraceInfo family implementations. */ #include "iixprivate.h" +#include "nsServiceManagerUtils.h" /***************************************************************************/ static inline @@ -549,9 +550,8 @@ NameTester(nsIInterfaceInfoManager* manager, const void* data, static nsresult FindInfo(InfoTester tester, const void* data, nsIInterfaceInfo** info) { - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); - + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); if(!iim) return NS_ERROR_UNEXPECTED; diff --git a/mozilla/js/src/xpconnect/src/nsXPConnect.cpp b/mozilla/js/src/xpconnect/src/nsXPConnect.cpp index 666581ff583..0ccbbebb66b 100644 --- a/mozilla/js/src/xpconnect/src/nsXPConnect.cpp +++ b/mozilla/js/src/xpconnect/src/nsXPConnect.cpp @@ -63,7 +63,7 @@ const char XPC_XPCONNECT_CONTRACTID[] = "@mozilla.org/js/xpc/XPConnect;1"; nsXPConnect::nsXPConnect() : mRuntime(nsnull), - mInterfaceInfoManager(nsnull), + mInterfaceInfoManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)), mContextStack(nsnull), mDefaultSecurityManager(nsnull), mDefaultSecurityManagerFlags(0), @@ -73,10 +73,6 @@ nsXPConnect::nsXPConnect() // then we'll set this up later as needed. CreateRuntime(); - nsCOMPtr iim = - dont_AddRef(XPTI_GetInterfaceInfoManager()); - CallQueryInterface(iim, &mInterfaceInfoManager); - CallGetService(XPC_CONTEXT_STACK_CONTRACTID, &mContextStack); #ifdef XPC_TOOLS_SUPPORT @@ -125,7 +121,6 @@ nsXPConnect::~nsXPConnect() } } - NS_IF_RELEASE(mInterfaceInfoManager); NS_IF_RELEASE(mContextStack); NS_IF_RELEASE(mDefaultSecurityManager); @@ -1219,7 +1214,7 @@ nsXPConnect::DebugDump(PRInt16 depth) XPC_LOG_ALWAYS(("gOnceAliveNowDead is %d", (int)gOnceAliveNowDead)); XPC_LOG_ALWAYS(("mDefaultSecurityManager @ %x", mDefaultSecurityManager)); XPC_LOG_ALWAYS(("mDefaultSecurityManagerFlags of %x", mDefaultSecurityManagerFlags)); - XPC_LOG_ALWAYS(("mInterfaceInfoManager @ %x", mInterfaceInfoManager)); + XPC_LOG_ALWAYS(("mInterfaceInfoManager @ %x", mInterfaceInfoManager.get())); XPC_LOG_ALWAYS(("mContextStack @ %x", mContextStack)); if(mRuntime) { diff --git a/mozilla/js/src/xpconnect/src/xpccomponents.cpp b/mozilla/js/src/xpconnect/src/xpccomponents.cpp index 8555e628a5c..67149133134 100644 --- a/mozilla/js/src/xpconnect/src/xpccomponents.cpp +++ b/mozilla/js/src/xpconnect/src/xpccomponents.cpp @@ -98,9 +98,9 @@ char * xpc_CheckAccessList(const PRUnichar* wideName, const char* list[]) /***************************************************************************/ -nsXPCComponents_Interfaces::nsXPCComponents_Interfaces() +nsXPCComponents_Interfaces::nsXPCComponents_Interfaces() : + mManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)) { - mManager = dont_AddRef(XPTI_GetInterfaceInfoManager()); } nsXPCComponents_Interfaces::~nsXPCComponents_Interfaces() @@ -342,9 +342,9 @@ private: }; -nsXPCComponents_InterfacesByID::nsXPCComponents_InterfacesByID() +nsXPCComponents_InterfacesByID::nsXPCComponents_InterfacesByID() : + mManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)) { - mManager = dont_AddRef(XPTI_GetInterfaceInfoManager()); } nsXPCComponents_InterfacesByID::~nsXPCComponents_InterfacesByID() diff --git a/mozilla/js/src/xpconnect/src/xpcprivate.h b/mozilla/js/src/xpconnect/src/xpcprivate.h index a63a7734c54..754e254a714 100644 --- a/mozilla/js/src/xpconnect/src/xpcprivate.h +++ b/mozilla/js/src/xpconnect/src/xpcprivate.h @@ -470,7 +470,7 @@ private: static PRThread* gMainThread; XPCJSRuntime* mRuntime; - nsIInterfaceInfoSuperManager* mInterfaceInfoManager; + nsCOMPtr mInterfaceInfoManager; nsIThreadJSContextStack* mContextStack; nsIXPCSecurityManager* mDefaultSecurityManager; PRUint16 mDefaultSecurityManagerFlags; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 00f7686e68e..aa5dc6becd9 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -5087,7 +5087,9 @@ NS_IMETHODIMP nsPluginHostImpl::LoadPlugins() // only if plugins have changed will we ask XPTI to refresh if (pluginschanged) { // rescan XPTI to catch any newly installed interfaces - nsCOMPtr iim (dont_AddRef(XPTI_GetInterfaceInfoManager())); + nsCOMPtr + iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); + if (iim) iim->AutoRegisterInterfaces(); } diff --git a/mozilla/xpcom/build/Makefile.in b/mozilla/xpcom/build/Makefile.in index 7b129e3fe20..5cc4e968446 100644 --- a/mozilla/xpcom/build/Makefile.in +++ b/mozilla/xpcom/build/Makefile.in @@ -160,8 +160,7 @@ DEFINES += \ -D_IMPL_NS_COM \ -D_IMPL_NS_STRINGAPI \ -DEXPORT_XPT_API \ - -DEXPORT_XPTC_API \ - -DEXPORT_XPTI_API + -DEXPORT_XPTC_API EXTRA_DSO_LDOPTS += $(NSPR_LIBS) diff --git a/mozilla/xpcom/build/dlldeps.cpp b/mozilla/xpcom/build/dlldeps.cpp index 7bd9744aa3f..c8dc783dff0 100644 --- a/mozilla/xpcom/build/dlldeps.cpp +++ b/mozilla/xpcom/build/dlldeps.cpp @@ -146,7 +146,6 @@ void XXXNeverCalled() XPTC_InvokeByIndex(nsnull, 0, 0, nsnull); xptc_dummy(); xptc_dummy2(); - XPTI_GetInterfaceInfoManager(); NS_NewGenericFactory(nsnull, nsnull); NS_NewGenericModule2(nsnull, nsnull); NS_GetWeakReference(nsnull); diff --git a/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h b/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h index cf0c9d1d463..6e21d33a855 100644 --- a/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h +++ b/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h @@ -41,48 +41,10 @@ #define xptiinfo_h___ #include "prtypes.h" +#include "nscore.h" #include "xpt_struct.h" -/* - * The linkage of XPTI API functions differs depending on whether the file is - * used within the XPTI library or not. Any source file within the XPTI - * library should define EXPORT_XPTI_API whereas any client of the library - * should not. - */ -#ifdef EXPORT_XPTI_API -#define XPTI_PUBLIC_API(t) PR_IMPLEMENT(t) -#define XPTI_PUBLIC_DATA(t) PR_IMPLEMENT_DATA(t) -#ifdef _WIN32 -# define XPTI_EXPORT __declspec(dllexport) -#else -# define XPTI_EXPORT -#endif -#else -#ifdef _WIN32 -# define XPTI_PUBLIC_API(t) __declspec(dllimport) t -# define XPTI_PUBLIC_DATA(t) __declspec(dllimport) t -# define XPTI_EXPORT __declspec(dllimport) -#else -# define XPTI_PUBLIC_API(t) PR_IMPLEMENT(t) -# define XPTI_PUBLIC_DATA(t) t -# define XPTI_EXPORT -#endif -#endif -#define XPTI_FRIEND_API(t) XPTI_PUBLIC_API(t) -#define XPTI_FRIEND_DATA(t) XPTI_PUBLIC_DATA(t) - class nsIInterfaceInfoManager; -PR_BEGIN_EXTERN_C -// Even if this is a service, it is cool to provide a direct accessor -XPTI_PUBLIC_API(nsIInterfaceInfoManager*) -XPTI_GetInterfaceInfoManager(); - -// Even if this is a service, it is cool to provide a direct accessor -XPTI_PUBLIC_API(void) -XPTI_FreeInterfaceInfoManager(); -PR_END_EXTERN_C - - // Flyweight wrapper classes for xpt_struct.h structs. // Everything here is dependent upon - and sensitive to changes in - diff --git a/mozilla/xpcom/reflect/xptinfo/src/Makefile.in b/mozilla/xpcom/reflect/xptinfo/src/Makefile.in index 66ce548945c..0fe17b6cd01 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/Makefile.in +++ b/mozilla/xpcom/reflect/xptinfo/src/Makefile.in @@ -73,5 +73,4 @@ include $(topsrcdir)/config/rules.mk # For nsManifestLineReader class. LOCAL_INCLUDES = -I$(srcdir)/../../../ds -DEFINES += -DEXPORT_XPTI_API -DEXPORT_XPT_API -D_IMPL_NS_COM -D_IMPL_NS_BASE - +DEFINES += -DEXPORT_XPT_API -D_IMPL_NS_COM diff --git a/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 5ae06914582..f6640a5ba42 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -2106,21 +2106,3 @@ NS_IMETHODIMP xptiInterfaceInfoManager::EnumerateAdditionalManagers(nsISimpleEnu NS_ADDREF(*_retval = enumerator); return NS_OK; } - -/***************************************************************************/ - -XPTI_PUBLIC_API(nsIInterfaceInfoManager*) -XPTI_GetInterfaceInfoManager() -{ - nsIInterfaceInfoManager* iim = - xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef(); - NS_IF_ADDREF(iim); - return iim; -} - -XPTI_PUBLIC_API(void) -XPTI_FreeInterfaceInfoManager() -{ - xptiInterfaceInfoManager::FreeInterfaceInfoManager(); -} - diff --git a/mozilla/xpcom/reflect/xptinfo/tests/Makefile.in b/mozilla/xpcom/reflect/xptinfo/tests/Makefile.in index 9b7f1ed4553..979b9ffe4df 100644 --- a/mozilla/xpcom/reflect/xptinfo/tests/Makefile.in +++ b/mozilla/xpcom/reflect/xptinfo/tests/Makefile.in @@ -54,5 +54,3 @@ LIBS = \ $(NULL) include $(topsrcdir)/config/rules.mk - -DEFINES += -DEXPORT_XPTI_API diff --git a/mozilla/xpcom/reflect/xptinfo/tests/TestInterfaceInfo.cpp b/mozilla/xpcom/reflect/xptinfo/tests/TestInterfaceInfo.cpp index 75005c50878..c8715defe04 100644 --- a/mozilla/xpcom/reflect/xptinfo/tests/TestInterfaceInfo.cpp +++ b/mozilla/xpcom/reflect/xptinfo/tests/TestInterfaceInfo.cpp @@ -43,6 +43,7 @@ #include "nsIInterfaceInfo.h" #include "nsIInterfaceInfoManager.h" #include "xptinfo.h" +#include "nsServiceManagerUtils.h" #include @@ -57,7 +58,8 @@ int main (int argc, char **argv) { char *name1, *name2, *name3; nsIInterfaceInfo *info2, *info3, *info4, *info5; - nsIInterfaceInfoManager *iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim + (do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); fprintf(stderr, "\ngetting iid for 'nsISupports'\n"); iim->GetIIDForName("nsISupports", &iid1);