Bug 315401 - XPTI_GetInterfaceInfoManager is a bad signature and should be removed, r=darin sr=jst

This commit is contained in:
bsmedberg%covad.net 2005-11-10 16:19:44 +00:00
Родитель 7df41771be
Коммит faf7d08562
17 изменённых файлов: 43 добавлений и 102 удалений

Просмотреть файл

@ -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<nsIInterfaceInfoManager> infoManager = getter_AddRefs(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
infoManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
if (!infoManager)
return NS_ERROR_FAILURE;

Просмотреть файл

@ -40,6 +40,7 @@
#include "xptcall.h"
#include "nsIInterfaceInfo.h"
#include "nsIInterfaceInfoManager.h"
#include "nsServiceManagerUtils.h"
#ifdef DEBUG
#include <stdio.h>
#endif
@ -143,8 +144,8 @@ nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_IMETHODIMP
nsXTFInterfaceAggregator::GetInterfaceInfo(nsIInterfaceInfo** info)
{
nsCOMPtr<nsIInterfaceInfoManager> iim =
getter_AddRefs(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ASSERTION(iim, "could not get interface info manager");
return iim->GetInfoForIID( &mIID, info);
}

Просмотреть файл

@ -40,6 +40,7 @@
#include "xptcall.h"
#include "nsIInterfaceInfo.h"
#include "nsIInterfaceInfoManager.h"
#include "nsServiceManagerUtils.h"
#ifdef DEBUG
#include <stdio.h>
#endif
@ -137,8 +138,8 @@ nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_IMETHODIMP
nsXTFWeakTearoff::GetInterfaceInfo(nsIInterfaceInfo** info)
{
nsCOMPtr<nsIInterfaceInfoManager> iim =
getter_AddRefs(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ASSERTION(iim, "could not get interface info manager");
return iim->GetInfoForIID( &mIID, info);
}

Просмотреть файл

@ -1464,8 +1464,8 @@ nsDOMClassInfo::RegisterClassProtos(PRInt32 aClassInfoID)
return NS_OK;
}
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIInterfaceInfo> if_info;
@ -3170,8 +3170,8 @@ nsDOMClassInfo::PostCreate(nsIXPConnectWrappedNative *wrapper,
#ifdef DEBUG
if (mData->mHasClassInterface) {
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
if (iim) {
nsCOMPtr<nsIInterfaceInfo> if_info;
@ -4401,8 +4401,8 @@ BaseStubConstructor(const nsGlobalNameStruct *name_struct, JSContext *cx,
static nsresult
DefineInterfaceConstants(JSContext *cx, JSObject *obj, const nsIID *aIID)
{
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIInterfaceInfo> if_info;
@ -4657,8 +4657,8 @@ DOMJSClass_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
ci_data = name_struct->mData;
}
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
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<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIInterfaceInfo> if_info;
@ -8989,8 +8989,8 @@ nsHTMLPluginObjElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
JSString *str = JSVAL_TO_STRING(id);
char* cstring = ::JS_GetStringBytes(str);
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED);
nsIID* iid = nsnull;

Просмотреть файл

@ -291,8 +291,8 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
nsresult
nsScriptNameSpaceManager::FillHashWithDOMInterfaces()
{
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
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<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsISimpleEnumerator> enumerator;

Просмотреть файл

@ -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<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
if(!iim)
return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -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<nsIInterfaceInfoManager> 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)
{

Просмотреть файл

@ -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()

Просмотреть файл

@ -470,7 +470,7 @@ private:
static PRThread* gMainThread;
XPCJSRuntime* mRuntime;
nsIInterfaceInfoSuperManager* mInterfaceInfoManager;
nsCOMPtr<nsIInterfaceInfoSuperManager> mInterfaceInfoManager;
nsIThreadJSContextStack* mContextStack;
nsIXPCSecurityManager* mDefaultSecurityManager;
PRUint16 mDefaultSecurityManagerFlags;

Просмотреть файл

@ -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<nsIInterfaceInfoManager> iim (dont_AddRef(XPTI_GetInterfaceInfoManager()));
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
if (iim)
iim->AutoRegisterInterfaces();
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 -

Просмотреть файл

@ -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

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -54,5 +54,3 @@ LIBS = \
$(NULL)
include $(topsrcdir)/config/rules.mk
DEFINES += -DEXPORT_XPTI_API

Просмотреть файл

@ -43,6 +43,7 @@
#include "nsIInterfaceInfo.h"
#include "nsIInterfaceInfoManager.h"
#include "xptinfo.h"
#include "nsServiceManagerUtils.h"
#include <stdio.h>
@ -57,7 +58,8 @@ int main (int argc, char **argv) {
char *name1, *name2, *name3;
nsIInterfaceInfo *info2, *info3, *info4, *info5;
nsIInterfaceInfoManager *iim = XPTI_GetInterfaceInfoManager();
nsCOMPtr<nsIInterfaceInfoManager> iim
(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
fprintf(stderr, "\ngetting iid for 'nsISupports'\n");
iim->GetIIDForName("nsISupports", &iid1);