fixes bug 266006 "xpcom/glue should not declare methods with NS_COM" r=bsmedberg

This commit is contained in:
darin%meer.net 2004-10-29 19:43:51 +00:00
Родитель 713fddd9b4
Коммит fb118993e7
19 изменённых файлов: 131 добавлений и 222 удалений

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

@ -1,3 +1,4 @@
# vim:set ts=8 sw=8 sts=8 noet:
# #
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1

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

@ -37,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h" #include "nsIComponentRegistrar.h"
#include "nsIAppStartupNotifier.h" #include "nsIAppStartupNotifier.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
@ -46,9 +47,6 @@
#include "nsXPCOM.h" #include "nsXPCOM.h"
#include "nsEmbedAPI.h" #include "nsEmbedAPI.h"
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsIServiceManagerUtils.h"
static nsIServiceManager *sServiceManager = nsnull; static nsIServiceManager *sServiceManager = nsnull;
static PRBool sRegistryInitializedFlag = PR_FALSE; static PRBool sRegistryInitializedFlag = PR_FALSE;
@ -112,65 +110,87 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
// Register components // Register components
if (!sRegistryInitializedFlag) if (!sRegistryInitializedFlag)
{ {
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(sServiceManager, &rv); #ifdef DEBUG
nsIComponentRegistrar *registrar;
rv = sServiceManager->QueryInterface(NS_GET_IID(nsIComponentRegistrar),
(void **) &registrar);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
{ {
NS_WARNING("Could not QI to registrar"); NS_WARNING("Could not QI to registrar");
return rv; return rv;
} }
#ifdef DEBUG
rv = registrar->AutoRegister(nsnull); rv = registrar->AutoRegister(nsnull);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
{ {
NS_WARNING("Could not AutoRegister"); NS_WARNING("Could not AutoRegister");
return rv;
} }
else
// If the application is using an GRE, then,
// auto register components in the GRE directory as well.
//
// The application indicates that it's using an GRE by
// returning a valid nsIFile when queried (via appFileLocProvider)
// for the NS_GRE_DIR atom as shown below
//
if (appFileLocProvider)
{ {
nsCOMPtr<nsIFile> greDir; // If the application is using an GRE, then, auto register components
PRBool persistent = PR_TRUE; // in the GRE directory as well.
//
// The application indicates that it's using an GRE by returning a
// valid nsIFile when queried (via appFileLocProvider) for the
// NS_GRE_DIR atom as shown below
appFileLocProvider->GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(greDir)); if (appFileLocProvider)
if (greDir)
{ {
rv = registrar->AutoRegister(greDir); nsIFile *greDir = nsnull;
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not AutoRegister GRE components"); PRBool persistent = PR_TRUE;
appFileLocProvider->GetFile(NS_GRE_DIR, &persistent,
&greDir);
if (greDir)
{
rv = registrar->AutoRegister(greDir);
if (NS_FAILED(rv))
NS_WARNING("Could not AutoRegister GRE components");
NS_RELEASE(greDir);
}
} }
} }
NS_RELEASE(registrar);
if (NS_FAILED(rv))
return rv;
#endif #endif
sRegistryInitializedFlag = PR_TRUE; sRegistryInitializedFlag = PR_TRUE;
} }
nsCOMPtr<nsIObserver> mStartupNotifier = do_CreateInstance(NS_APPSTARTUPNOTIFIER_CONTRACTID, &rv); nsIComponentManager *compMgr;
if(NS_FAILED(rv)) rv = sServiceManager->QueryInterface(NS_GET_IID(nsIComponentManager),
return rv; (void **) &compMgr);
mStartupNotifier->Observe(nsnull, APPSTARTUP_TOPIC, nsnull); if (NS_FAILED(rv))
return rv;
nsIObserver *startupNotifier;
rv = compMgr->CreateInstanceByContractID(NS_APPSTARTUPNOTIFIER_CONTRACTID,
NULL,
NS_GET_IID(nsIObserver),
(void **) &startupNotifier);
NS_RELEASE(compMgr);
if (NS_FAILED(rv))
return rv;
startupNotifier->Observe(nsnull, APPSTARTUP_TOPIC, nsnull);
NS_RELEASE(startupNotifier);
#ifdef HACK_AROUND_THREADING_ISSUES #ifdef HACK_AROUND_THREADING_ISSUES
// XXX force certain objects to be created on the main thread // XXX force certain objects to be created on the main thread
nsCOMPtr<nsIStringBundleService> sBundleService; nsIStringBundleService *bundleService;
sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); rv = sServiceManager->GetServiceByContractID(NS_STRINGBUNDLE_CONTRACTID,
NS_GET_IID(nsIStringBundleService),
(void **) &bundleService);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
nsCOMPtr<nsIStringBundle> stringBundle; nsIStringBundle *stringBundle;
const char propertyURL[] = "chrome://necko/locale/necko.properties"; const char propertyURL[] = "chrome://necko/locale/necko.properties";
rv = sBundleService->CreateBundle(propertyURL, rv = bundleService->CreateBundle(propertyURL, &stringBundle);
getter_AddRefs(stringBundle)); NS_RELEASE(stringBundle);
NS_RELEASE(bundleService);
} }
#endif #endif
return NS_OK; return NS_OK;
} }
nsresult NS_TermEmbedding() nsresult NS_TermEmbedding()

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

@ -238,6 +238,12 @@
#define NS_COM NS_IMPORT #define NS_COM NS_IMPORT
#endif #endif
#ifdef MOZILLA_STRICT_API
#define NS_COM_GLUE
#else
#define NS_COM_GLUE NS_COM
#endif
/** /**
* NS_NO_VTABLE is emitted by xpidl in interface declarations whenever * NS_NO_VTABLE is emitted by xpidl in interface declarations whenever

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

@ -1,3 +1,4 @@
# vim:set ts=8 sw=8 sts=8 noet:
# #
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -41,6 +42,7 @@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(srcdir)/../glue/objs.mk
MODULE = xpcom MODULE = xpcom
LIBRARY_NAME = xpcom_core LIBRARY_NAME = xpcom_core
@ -67,7 +69,10 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
REQUIRES += macmorefiles REQUIRES += macmorefiles
endif endif
CPPSRCS = nsXPComInit.cpp CPPSRCS = \
$(XPCOM_GLUE_SRC_LCSRCS) \
nsXPComInit.cpp \
$(NULL)
ifeq ($(OS_ARCH),WINNT) ifeq ($(OS_ARCH),WINNT)
CPPSRCS += dlldeps.cpp CPPSRCS += dlldeps.cpp
@ -97,10 +102,10 @@ SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)xpt.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)xpt.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)xptcmd.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)xptcmd.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL) $(NULL)
LOCAL_INCLUDES = \ LOCAL_INCLUDES = \
-I$(srcdir) \
-I.. \ -I.. \
-I$(srcdir)/../glue \ -I$(srcdir)/../glue \
-I$(srcdir)/../base \ -I$(srcdir)/../base \
@ -132,6 +137,8 @@ FORCE_SHARED_LIB = 1
# UNIX98 iconv support # UNIX98 iconv support
OS_LIBS += $(LIBICONV) OS_LIBS += $(LIBICONV)
GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
DEFINES += \ DEFINES += \
@ -161,3 +168,6 @@ ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,imagehlp) EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,imagehlp)
endif endif
endif # WINNT endif # WINNT
export:: $(XPCOM_GLUE_SRC_CSRCS)
$(INSTALL) $^ .

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

@ -1,3 +1,4 @@
# vim:set ts=8 sw=8 sts=8 noet:
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
# #
@ -82,5 +83,4 @@ include $(topsrcdir)/config/rules.mk
export:: export::
rm -f $(XPCOM_GLUE_SRC_CSRCS:.cpp=.$(OBJ_SUFFIX)) rm -f $(XPCOM_GLUE_SRC_CSRCS:.cpp=.$(OBJ_SUFFIX))
DEFINES += \ DEFINES += -DMOZILLA_STRICT_API
-D_IMPL_NS_COM

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

@ -67,7 +67,7 @@
#ifndef nscore_h___ #ifndef nscore_h___
#include "nscore.h" #include "nscore.h"
// for |NS_..._CAST|, |NS_COM| // for |NS_..._CAST|, |NS_COM_GLUE|
#endif #endif
@ -341,7 +341,7 @@ class nsCOMPtr_helper
warrant the specialcasing. warrant the specialcasing.
*/ */
class NS_COM nsQueryInterface class NS_COM_GLUE nsQueryInterface
{ {
public: public:
explicit explicit
@ -357,7 +357,7 @@ class NS_COM nsQueryInterface
nsISupports* mRawPtr; nsISupports* mRawPtr;
}; };
class NS_COM nsQueryInterfaceWithError class NS_COM_GLUE nsQueryInterfaceWithError
{ {
public: public:
nsQueryInterfaceWithError( nsISupports* aRawPtr, nsresult* error ) nsQueryInterfaceWithError( nsISupports* aRawPtr, nsresult* error )
@ -432,13 +432,13 @@ class nsCOMPtr_base
// nothing else to do here // nothing else to do here
} }
NS_COM NS_FASTCALL ~nsCOMPtr_base(); NS_COM_GLUE NS_FASTCALL ~nsCOMPtr_base();
NS_COM void NS_FASTCALL assign_with_AddRef( nsISupports* ); NS_COM_GLUE void NS_FASTCALL assign_with_AddRef( nsISupports* );
NS_COM void NS_FASTCALL assign_from_qi( const nsQueryInterface, const nsIID& ); NS_COM_GLUE void NS_FASTCALL assign_from_qi( const nsQueryInterface, const nsIID& );
NS_COM void NS_FASTCALL assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& ); NS_COM_GLUE void NS_FASTCALL assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& );
NS_COM void NS_FASTCALL assign_from_helper( const nsCOMPtr_helper&, const nsIID& ); NS_COM_GLUE void NS_FASTCALL assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
NS_COM void** NS_FASTCALL begin_assignment(); NS_COM_GLUE void** NS_FASTCALL begin_assignment();
protected: protected:
NS_MAY_ALIAS_PTR(nsISupports) mRawPtr; NS_MAY_ALIAS_PTR(nsISupports) mRawPtr;

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

@ -75,7 +75,7 @@ void GlueShutdownDebug()
} }
#endif #endif
NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) NS_COM_GLUE void nsDebug::Abort(const char* aFile, PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)
return; return;
@ -83,7 +83,7 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine)
gDebugObject->Abort(aFile, aLine); gDebugObject->Abort(aFile, aLine);
} }
NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine) NS_COM_GLUE void nsDebug::Break(const char* aFile, PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)
return; return;
@ -91,7 +91,7 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine)
gDebugObject->Break(aFile, aLine); gDebugObject->Break(aFile, aLine);
} }
NS_COM void nsDebug::Warning(const char* aStr, NS_COM_GLUE void nsDebug::Warning(const char* aStr,
const char* aFile, const char* aFile,
PRIntn aLine) PRIntn aLine)
{ {
@ -100,7 +100,7 @@ NS_COM void nsDebug::Warning(const char* aStr,
gDebugObject->Warning(aStr, aFile, aLine); gDebugObject->Warning(aStr, aFile, aLine);
} }
NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, NS_COM_GLUE void nsDebug::Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine) const char* aFile, PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)

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

@ -65,23 +65,23 @@ public:
/** /**
* Log a warning message to the debug log. * Log a warning message to the debug log.
*/ */
static NS_COM void Warning(const char* aMessage, static NS_COM_GLUE void Warning(const char* aMessage,
const char* aFile, PRIntn aLine); const char* aFile, PRIntn aLine);
/** /**
* Abort the executing program. This works on all architectures. * Abort the executing program. This works on all architectures.
*/ */
static NS_COM void Abort(const char* aFile, PRIntn aLine); static NS_COM_GLUE void Abort(const char* aFile, PRIntn aLine);
/** /**
* Break the executing program into the debugger. * Break the executing program into the debugger.
*/ */
static NS_COM void Break(const char* aFile, PRIntn aLine); static NS_COM_GLUE void Break(const char* aFile, PRIntn aLine);
/** /**
* Log an assertion message to the debug log * Log an assertion message to the debug log
*/ */
static NS_COM void Assertion(const char* aStr, const char* aExpr, static NS_COM_GLUE void Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine); const char* aFile, PRIntn aLine);
}; };

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

@ -200,7 +200,7 @@ NS_METHOD nsGenericFactory::Create(nsISupports* outer, const nsIID& aIID, void*
return res; return res;
} }
NS_COM nsresult NS_COM_GLUE nsresult
NS_NewGenericFactory(nsIGenericFactory* *result, NS_NewGenericFactory(nsIGenericFactory* *result,
const nsModuleComponentInfo *info) const nsModuleComponentInfo *info)
{ {
@ -506,7 +506,7 @@ nsGenericModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
NS_COM nsresult NS_COM_GLUE nsresult
NS_NewGenericModule2(nsModuleInfo* info, nsIModule* *result) NS_NewGenericModule2(nsModuleInfo* info, nsIModule* *result)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
@ -524,7 +524,7 @@ NS_NewGenericModule2(nsModuleInfo* info, nsIModule* *result)
return rv; return rv;
} }
NS_COM nsresult NS_COM_GLUE nsresult
NS_NewGenericModule(const char* moduleName, NS_NewGenericModule(const char* moduleName,
PRUint32 componentCount, PRUint32 componentCount,
nsModuleComponentInfo* components, nsModuleComponentInfo* components,

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

@ -72,7 +72,7 @@ public:
NS_IMETHOD GetComponentInfo(const nsModuleComponentInfo **infop) = 0; NS_IMETHOD GetComponentInfo(const nsModuleComponentInfo **infop) = 0;
}; };
NS_COM nsresult NS_COM_GLUE nsresult
NS_NewGenericFactory(nsIGenericFactory **result, NS_NewGenericFactory(nsIGenericFactory **result,
const nsModuleComponentInfo *info); const nsModuleComponentInfo *info);
@ -306,13 +306,13 @@ struct nsModuleInfo {
* Create a new generic module. Use the NS_IMPL_NSGETMODULE macro, or * Create a new generic module. Use the NS_IMPL_NSGETMODULE macro, or
* one of its relatives, rather than using this directly. * one of its relatives, rather than using this directly.
*/ */
NS_COM nsresult NS_COM_GLUE nsresult
NS_NewGenericModule2(nsModuleInfo *info, nsIModule* *result); NS_NewGenericModule2(nsModuleInfo *info, nsIModule* *result);
/** /**
* Obsolete. Use NS_NewGenericModule2() instead. * Obsolete. Use NS_NewGenericModule2() instead.
*/ */
NS_COM nsresult NS_COM_GLUE nsresult
NS_NewGenericModule(const char* moduleName, NS_NewGenericModule(const char* moduleName,
PRUint32 componentCount, PRUint32 componentCount,
nsModuleComponentInfo* components, nsModuleComponentInfo* components,

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

@ -55,7 +55,7 @@ CallGetInterface( T* aSource, DestinationType** aDestination )
NS_REINTERPRET_CAST(void**, aDestination)); NS_REINTERPRET_CAST(void**, aDestination));
} }
class NS_COM nsGetInterface : public nsCOMPtr_helper class NS_COM_GLUE nsGetInterface : public nsCOMPtr_helper
{ {
public: public:
nsGetInterface( nsISupports* aSource, nsresult* error ) nsGetInterface( nsISupports* aSource, nsresult* error )

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

@ -64,7 +64,7 @@ CallQueryReferent( T* aSource, DestinationType** aDestination )
} }
class NS_COM nsQueryReferent : public nsCOMPtr_helper class NS_COM_GLUE nsQueryReferent : public nsCOMPtr_helper
{ {
public: public:
nsQueryReferent( nsIWeakReference* aWeakPtr, nsresult* error ) nsQueryReferent( nsIWeakReference* aWeakPtr, nsresult* error )
@ -90,7 +90,7 @@ do_QueryReferent( nsIWeakReference* aRawPtr, nsresult* error = 0 )
class NS_COM nsGetWeakReference : public nsCOMPtr_helper class NS_COM_GLUE nsGetWeakReference : public nsCOMPtr_helper
{ {
public: public:
nsGetWeakReference( nsISupports* aRawPtr, nsresult* error ) nsGetWeakReference( nsISupports* aRawPtr, nsresult* error )
@ -155,7 +155,7 @@ do_GetWeakReference( already_AddRefed<T>&, nsresult* )
/** /**
* Deprecated, use |do_GetWeakReference| instead. * Deprecated, use |do_GetWeakReference| instead.
*/ */
extern NS_COM extern NS_COM_GLUE
nsIWeakReference* nsIWeakReference*
NS_GetWeakReference( nsISupports* , nsresult* aResult=0 ); NS_GetWeakReference( nsISupports* , nsresult* aResult=0 );

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

@ -80,7 +80,7 @@ void GlueShutdownMemory()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsMemory static helper routines // nsMemory static helper routines
NS_COM void* NS_COM_GLUE void*
nsMemory::Alloc(PRSize size) nsMemory::Alloc(PRSize size)
{ {
if (!ENSURE_ALLOCATOR) if (!ENSURE_ALLOCATOR)
@ -89,7 +89,7 @@ nsMemory::Alloc(PRSize size)
return gMemory->Alloc(size); return gMemory->Alloc(size);
} }
NS_COM void* NS_COM_GLUE void*
nsMemory::Realloc(void* ptr, PRSize size) nsMemory::Realloc(void* ptr, PRSize size)
{ {
if (!ENSURE_ALLOCATOR) if (!ENSURE_ALLOCATOR)
@ -98,7 +98,7 @@ nsMemory::Realloc(void* ptr, PRSize size)
return gMemory->Realloc(ptr, size); return gMemory->Realloc(ptr, size);
} }
NS_COM void NS_COM_GLUE void
nsMemory::Free(void* ptr) nsMemory::Free(void* ptr)
{ {
if (!ENSURE_ALLOCATOR) if (!ENSURE_ALLOCATOR)
@ -107,7 +107,7 @@ nsMemory::Free(void* ptr)
gMemory->Free(ptr); gMemory->Free(ptr);
} }
NS_COM nsresult NS_COM_GLUE nsresult
nsMemory::HeapMinimize(PRBool aImmediate) nsMemory::HeapMinimize(PRBool aImmediate)
{ {
if (!ENSURE_ALLOCATOR) if (!ENSURE_ALLOCATOR)
@ -116,7 +116,7 @@ nsMemory::HeapMinimize(PRBool aImmediate)
return gMemory->HeapMinimize(aImmediate); return gMemory->HeapMinimize(aImmediate);
} }
NS_COM void* NS_COM_GLUE void*
nsMemory::Clone(const void* ptr, PRSize size) nsMemory::Clone(const void* ptr, PRSize size)
{ {
if (!ENSURE_ALLOCATOR) if (!ENSURE_ALLOCATOR)
@ -128,7 +128,7 @@ nsMemory::Clone(const void* ptr, PRSize size)
return newPtr; return newPtr;
} }
NS_COM nsIMemory* NS_COM_GLUE nsIMemory*
nsMemory::GetGlobalMemoryService() nsMemory::GetGlobalMemoryService()
{ {
if (!ENSURE_ALLOCATOR) if (!ENSURE_ALLOCATOR)

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

@ -63,12 +63,12 @@
class nsMemory class nsMemory
{ {
public: public:
static NS_COM void* Alloc(size_t size); static NS_COM_GLUE void* Alloc(size_t size);
static NS_COM void* Realloc(void* ptr, size_t size); static NS_COM_GLUE void* Realloc(void* ptr, size_t size);
static NS_COM void Free(void* ptr); static NS_COM_GLUE void Free(void* ptr);
static NS_COM nsresult HeapMinimize(PRBool aImmediate); static NS_COM_GLUE nsresult HeapMinimize(PRBool aImmediate);
static NS_COM void* Clone(const void* ptr, size_t size); static NS_COM_GLUE void* Clone(const void* ptr, size_t size);
static NS_COM nsIMemory* GetGlobalMemoryService(); // AddRefs static NS_COM_GLUE nsIMemory* GetGlobalMemoryService(); // AddRefs
}; };
/** /**

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

@ -1,125 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is XPCOM
*
* The Initial Developer of the Original Code is Doug Turner <dougt@meer.net>
*
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsXPCOM.h"
#include "nsXPCOMPrivate.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsTraceRefcnt.h"
#include "nsTraceRefcntImpl.h"
static nsITraceRefcnt* gTraceRefcntObject = nsnull;
static NS_METHOD FreeTraceRefcntObject(void)
{
NS_IF_RELEASE(gTraceRefcntObject);
return NS_OK;
}
#define ENSURE_TRACEOBJECT \
(gTraceRefcntObject || SetupTraceRefcntObject() != nsnull)
static nsITraceRefcnt* SetupTraceRefcntObject()
{
NS_GetTraceRefcnt(&gTraceRefcntObject);
if (gTraceRefcntObject)
NS_RegisterXPCOMExitRoutine(FreeTraceRefcntObject, 0);
return gTraceRefcntObject;
}
#ifdef XPCOM_GLUE
nsresult GlueStartupTraceRefcnt()
{
NS_GetTraceRefcnt(&gTraceRefcntObject);
if (!gTraceRefcntObject)
return NS_ERROR_FAILURE;
return NS_OK;
}
void GlueShutdownTraceRefcnt()
{
NS_IF_RELEASE(gTraceRefcntObject);
}
#endif
NS_COM void
nsTraceRefcnt::LogAddRef(void * aPtr, nsrefcnt aNewRefcnt, const char *aTypeName, PRUint32 aInstanceSize)
{
if (!ENSURE_TRACEOBJECT)
return;
gTraceRefcntObject->LogAddRef(aPtr, aNewRefcnt, aTypeName, aInstanceSize);
}
NS_COM void
nsTraceRefcnt::LogRelease(void * aPtr, nsrefcnt aNewRefcnt, const char *aTypeName)
{
if (!ENSURE_TRACEOBJECT)
return;
gTraceRefcntObject->LogRelease(aPtr, aNewRefcnt, aTypeName);
}
NS_COM void
nsTraceRefcnt::LogCtor(void * aPtr, const char *aTypeName, PRUint32 aInstanceSize)
{
if (!ENSURE_TRACEOBJECT)
return;
gTraceRefcntObject->LogCtor(aPtr, aTypeName, aInstanceSize);
}
NS_COM void
nsTraceRefcnt::LogDtor(void * aPtr, const char *aTypeName, PRUint32 aInstanceSize)
{
if (!ENSURE_TRACEOBJECT)
return;
gTraceRefcntObject->LogDtor(aPtr, aTypeName, aInstanceSize);
}
NS_COM void
nsTraceRefcnt::LogAddCOMPtr(void * aPtr, nsISupports *aObject)
{
if (!ENSURE_TRACEOBJECT)
return;
gTraceRefcntObject->LogAddCOMPtr(aPtr, aObject);
}
NS_COM void
nsTraceRefcnt::LogReleaseCOMPtr(void * aPtr, nsISupports *aObject)
{
if (!ENSURE_TRACEOBJECT)
return;
gTraceRefcntObject->LogReleaseCOMPtr(aPtr, aObject);
}

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

@ -112,24 +112,24 @@ PR_END_MACRO
*/ */
class nsTraceRefcnt { class nsTraceRefcnt {
public: public:
static NS_COM void LogAddRef(void* aPtr, static NS_COM_GLUE void LogAddRef(void* aPtr,
nsrefcnt aNewRefCnt, nsrefcnt aNewRefCnt,
const char* aTypeName, const char* aTypeName,
PRUint32 aInstanceSize); PRUint32 aInstanceSize);
static NS_COM void LogRelease(void* aPtr, static NS_COM_GLUE void LogRelease(void* aPtr,
nsrefcnt aNewRefCnt, nsrefcnt aNewRefCnt,
const char* aTypeName); const char* aTypeName);
static NS_COM void LogCtor(void* aPtr, const char* aTypeName, static NS_COM_GLUE void LogCtor(void* aPtr, const char* aTypeName,
PRUint32 aInstanceSize); PRUint32 aInstanceSize);
static NS_COM void LogDtor(void* aPtr, const char* aTypeName, static NS_COM_GLUE void LogDtor(void* aPtr, const char* aTypeName,
PRUint32 aInstanceSize); PRUint32 aInstanceSize);
static NS_COM void LogAddCOMPtr(void *aCOMPtr, nsISupports *aObject); static NS_COM_GLUE void LogAddCOMPtr(void *aCOMPtr, nsISupports *aObject);
static NS_COM void LogReleaseCOMPtr(void *aCOMPtr, nsISupports *aObject); static NS_COM_GLUE void LogReleaseCOMPtr(void *aCOMPtr, nsISupports *aObject);
}; };
#endif /* nsTraceRefcnt_h___ */ #endif /* nsTraceRefcnt_h___ */

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

@ -88,7 +88,7 @@ nsGetWeakReference::operator()( const nsIID&, void** aResult ) const
} }
NS_COM nsIWeakReference* // or else |already_AddRefed<nsIWeakReference>| NS_COM_GLUE nsIWeakReference* // or else |already_AddRefed<nsIWeakReference>|
NS_GetWeakReference( nsISupports* aInstancePtr, nsresult* aErrorPtr ) NS_GetWeakReference( nsISupports* aInstancePtr, nsresult* aErrorPtr )
{ {
void* result = 0; void* result = 0;
@ -96,7 +96,7 @@ NS_GetWeakReference( nsISupports* aInstancePtr, nsresult* aErrorPtr )
return NS_STATIC_CAST(nsIWeakReference*, result); return NS_STATIC_CAST(nsIWeakReference*, result);
} }
NS_COM nsresult NS_COM_GLUE nsresult
nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr ) nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr )
{ {
if ( !aInstancePtr ) if ( !aInstancePtr )

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

@ -50,7 +50,7 @@ class nsWeakReference;
#undef IMETHOD_VISIBILITY #undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT #define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference class NS_COM_GLUE nsSupportsWeakReference : public nsISupportsWeakReference
{ {
public: public:
nsSupportsWeakReference() nsSupportsWeakReference()
@ -85,7 +85,7 @@ class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference
#undef IMETHOD_VISIBILITY #undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN #define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
class NS_COM nsWeakReference : public nsIWeakReference class NS_COM_GLUE nsWeakReference : public nsIWeakReference
{ {
public: public:
// nsISupports... // nsISupports...

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

@ -1,3 +1,4 @@
# vim:set ts=8 sw=8 sts=8 noet:
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
# #
@ -74,10 +75,6 @@ FORCE_USE_PIC = 1
GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX)) GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
ifeq ($(OS_ARCH),WINNT)
GARBAGE += $(addprefix $(srcdir)/,$(XPCOM_GLUE_SRC_LCSRCS))
endif
SRCS_IN_OBJDIR = 1 SRCS_IN_OBJDIR = 1
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk