зеркало из https://github.com/mozilla/pjs.git
fixes bug 266006 "xpcom/glue should not declare methods with NS_COM" r=bsmedberg
This commit is contained in:
Родитель
713fddd9b4
Коммит
fb118993e7
|
@ -1,3 +1,4 @@
|
|||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsIAppStartupNotifier.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
@ -46,9 +47,6 @@
|
|||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsEmbedAPI.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
static nsIServiceManager *sServiceManager = nsnull;
|
||||
static PRBool sRegistryInitializedFlag = PR_FALSE;
|
||||
|
@ -112,65 +110,87 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
|||
// Register components
|
||||
if (!sRegistryInitializedFlag)
|
||||
{
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(sServiceManager, &rv);
|
||||
#ifdef DEBUG
|
||||
nsIComponentRegistrar *registrar;
|
||||
rv = sServiceManager->QueryInterface(NS_GET_IID(nsIComponentRegistrar),
|
||||
(void **) ®istrar);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
NS_WARNING("Could not QI to registrar");
|
||||
return rv;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
rv = registrar->AutoRegister(nsnull);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
NS_WARNING("Could not AutoRegister");
|
||||
return rv;
|
||||
}
|
||||
|
||||
// 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)
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIFile> greDir;
|
||||
PRBool persistent = PR_TRUE;
|
||||
// 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
|
||||
|
||||
appFileLocProvider->GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(greDir));
|
||||
|
||||
if (greDir)
|
||||
if (appFileLocProvider)
|
||||
{
|
||||
rv = registrar->AutoRegister(greDir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not AutoRegister GRE components");
|
||||
nsIFile *greDir = nsnull;
|
||||
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
|
||||
sRegistryInitializedFlag = PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserver> mStartupNotifier = do_CreateInstance(NS_APPSTARTUPNOTIFIER_CONTRACTID, &rv);
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
mStartupNotifier->Observe(nsnull, APPSTARTUP_TOPIC, nsnull);
|
||||
nsIComponentManager *compMgr;
|
||||
rv = sServiceManager->QueryInterface(NS_GET_IID(nsIComponentManager),
|
||||
(void **) &compMgr);
|
||||
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
|
||||
// XXX force certain objects to be created on the main thread
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService;
|
||||
sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
nsIStringBundleService *bundleService;
|
||||
rv = sServiceManager->GetServiceByContractID(NS_STRINGBUNDLE_CONTRACTID,
|
||||
NS_GET_IID(nsIStringBundleService),
|
||||
(void **) &bundleService);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
nsIStringBundle *stringBundle;
|
||||
const char propertyURL[] = "chrome://necko/locale/necko.properties";
|
||||
rv = sBundleService->CreateBundle(propertyURL,
|
||||
getter_AddRefs(stringBundle));
|
||||
rv = bundleService->CreateBundle(propertyURL, &stringBundle);
|
||||
NS_RELEASE(stringBundle);
|
||||
NS_RELEASE(bundleService);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
nsresult NS_TermEmbedding()
|
||||
|
|
|
@ -238,6 +238,12 @@
|
|||
#define NS_COM NS_IMPORT
|
||||
#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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
@ -41,6 +42,7 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(srcdir)/../glue/objs.mk
|
||||
|
||||
MODULE = xpcom
|
||||
LIBRARY_NAME = xpcom_core
|
||||
|
@ -67,7 +69,10 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
|||
REQUIRES += macmorefiles
|
||||
endif
|
||||
|
||||
CPPSRCS = nsXPComInit.cpp
|
||||
CPPSRCS = \
|
||||
$(XPCOM_GLUE_SRC_LCSRCS) \
|
||||
nsXPComInit.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
CPPSRCS += dlldeps.cpp
|
||||
|
@ -97,10 +102,10 @@ SHARED_LIBRARY_LIBS = \
|
|||
$(DIST)/lib/$(LIB_PREFIX)xpt.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xptcmd.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir) \
|
||||
-I.. \
|
||||
-I$(srcdir)/../glue \
|
||||
-I$(srcdir)/../base \
|
||||
|
@ -132,6 +137,8 @@ FORCE_SHARED_LIB = 1
|
|||
# UNIX98 iconv support
|
||||
OS_LIBS += $(LIBICONV)
|
||||
|
||||
GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += \
|
||||
|
@ -161,3 +168,6 @@ ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
|
|||
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,imagehlp)
|
||||
endif
|
||||
endif # WINNT
|
||||
|
||||
export:: $(XPCOM_GLUE_SRC_CSRCS)
|
||||
$(INSTALL) $^ .
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
|
@ -82,5 +83,4 @@ include $(topsrcdir)/config/rules.mk
|
|||
export::
|
||||
rm -f $(XPCOM_GLUE_SRC_CSRCS:.cpp=.$(OBJ_SUFFIX))
|
||||
|
||||
DEFINES += \
|
||||
-D_IMPL_NS_COM
|
||||
DEFINES += -DMOZILLA_STRICT_API
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
#ifndef nscore_h___
|
||||
#include "nscore.h"
|
||||
// for |NS_..._CAST|, |NS_COM|
|
||||
// for |NS_..._CAST|, |NS_COM_GLUE|
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -341,7 +341,7 @@ class nsCOMPtr_helper
|
|||
warrant the specialcasing.
|
||||
*/
|
||||
|
||||
class NS_COM nsQueryInterface
|
||||
class NS_COM_GLUE nsQueryInterface
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
|
@ -357,7 +357,7 @@ class NS_COM nsQueryInterface
|
|||
nsISupports* mRawPtr;
|
||||
};
|
||||
|
||||
class NS_COM nsQueryInterfaceWithError
|
||||
class NS_COM_GLUE nsQueryInterfaceWithError
|
||||
{
|
||||
public:
|
||||
nsQueryInterfaceWithError( nsISupports* aRawPtr, nsresult* error )
|
||||
|
@ -432,13 +432,13 @@ class nsCOMPtr_base
|
|||
// 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 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 void NS_FASTCALL assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
|
||||
NS_COM void** NS_FASTCALL begin_assignment();
|
||||
NS_COM_GLUE void NS_FASTCALL assign_with_AddRef( nsISupports* );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_qi( const nsQueryInterface, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
|
||||
NS_COM_GLUE void** NS_FASTCALL begin_assignment();
|
||||
|
||||
protected:
|
||||
NS_MAY_ALIAS_PTR(nsISupports) mRawPtr;
|
||||
|
|
|
@ -75,7 +75,7 @@ void GlueShutdownDebug()
|
|||
}
|
||||
#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)
|
||||
return;
|
||||
|
@ -83,7 +83,7 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn 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)
|
||||
return;
|
||||
|
@ -91,7 +91,7 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn 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,
|
||||
PRIntn aLine)
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ NS_COM void nsDebug::Warning(const char* aStr,
|
|||
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)
|
||||
{
|
||||
if (!ENSURE_DEBUGOBJECT)
|
||||
|
|
|
@ -65,23 +65,23 @@ public:
|
|||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ NS_METHOD nsGenericFactory::Create(nsISupports* outer, const nsIID& aIID, void*
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
NS_NewGenericFactory(nsIGenericFactory* *result,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
|
@ -506,7 +506,7 @@ nsGenericModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
NS_NewGenericModule2(nsModuleInfo* info, nsIModule* *result)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -524,7 +524,7 @@ NS_NewGenericModule2(nsModuleInfo* info, nsIModule* *result)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
NS_NewGenericModule(const char* moduleName,
|
||||
PRUint32 componentCount,
|
||||
nsModuleComponentInfo* components,
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
NS_IMETHOD GetComponentInfo(const nsModuleComponentInfo **infop) = 0;
|
||||
};
|
||||
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
NS_NewGenericFactory(nsIGenericFactory **result,
|
||||
const nsModuleComponentInfo *info);
|
||||
|
||||
|
@ -306,13 +306,13 @@ struct nsModuleInfo {
|
|||
* Create a new generic module. Use the NS_IMPL_NSGETMODULE macro, or
|
||||
* one of its relatives, rather than using this directly.
|
||||
*/
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
NS_NewGenericModule2(nsModuleInfo *info, nsIModule* *result);
|
||||
|
||||
/**
|
||||
* Obsolete. Use NS_NewGenericModule2() instead.
|
||||
*/
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
NS_NewGenericModule(const char* moduleName,
|
||||
PRUint32 componentCount,
|
||||
nsModuleComponentInfo* components,
|
||||
|
|
|
@ -55,7 +55,7 @@ CallGetInterface( T* aSource, DestinationType** aDestination )
|
|||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
class NS_COM nsGetInterface : public nsCOMPtr_helper
|
||||
class NS_COM_GLUE nsGetInterface : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
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:
|
||||
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:
|
||||
nsGetWeakReference( nsISupports* aRawPtr, nsresult* error )
|
||||
|
@ -155,7 +155,7 @@ do_GetWeakReference( already_AddRefed<T>&, nsresult* )
|
|||
/**
|
||||
* Deprecated, use |do_GetWeakReference| instead.
|
||||
*/
|
||||
extern NS_COM
|
||||
extern NS_COM_GLUE
|
||||
nsIWeakReference*
|
||||
NS_GetWeakReference( nsISupports* , nsresult* aResult=0 );
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void GlueShutdownMemory()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsMemory static helper routines
|
||||
|
||||
NS_COM void*
|
||||
NS_COM_GLUE void*
|
||||
nsMemory::Alloc(PRSize size)
|
||||
{
|
||||
if (!ENSURE_ALLOCATOR)
|
||||
|
@ -89,7 +89,7 @@ nsMemory::Alloc(PRSize size)
|
|||
return gMemory->Alloc(size);
|
||||
}
|
||||
|
||||
NS_COM void*
|
||||
NS_COM_GLUE void*
|
||||
nsMemory::Realloc(void* ptr, PRSize size)
|
||||
{
|
||||
if (!ENSURE_ALLOCATOR)
|
||||
|
@ -98,7 +98,7 @@ nsMemory::Realloc(void* ptr, PRSize size)
|
|||
return gMemory->Realloc(ptr, size);
|
||||
}
|
||||
|
||||
NS_COM void
|
||||
NS_COM_GLUE void
|
||||
nsMemory::Free(void* ptr)
|
||||
{
|
||||
if (!ENSURE_ALLOCATOR)
|
||||
|
@ -107,7 +107,7 @@ nsMemory::Free(void* ptr)
|
|||
gMemory->Free(ptr);
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
nsMemory::HeapMinimize(PRBool aImmediate)
|
||||
{
|
||||
if (!ENSURE_ALLOCATOR)
|
||||
|
@ -116,7 +116,7 @@ nsMemory::HeapMinimize(PRBool aImmediate)
|
|||
return gMemory->HeapMinimize(aImmediate);
|
||||
}
|
||||
|
||||
NS_COM void*
|
||||
NS_COM_GLUE void*
|
||||
nsMemory::Clone(const void* ptr, PRSize size)
|
||||
{
|
||||
if (!ENSURE_ALLOCATOR)
|
||||
|
@ -128,7 +128,7 @@ nsMemory::Clone(const void* ptr, PRSize size)
|
|||
return newPtr;
|
||||
}
|
||||
|
||||
NS_COM nsIMemory*
|
||||
NS_COM_GLUE nsIMemory*
|
||||
nsMemory::GetGlobalMemoryService()
|
||||
{
|
||||
if (!ENSURE_ALLOCATOR)
|
||||
|
|
|
@ -63,12 +63,12 @@
|
|||
class nsMemory
|
||||
{
|
||||
public:
|
||||
static NS_COM void* Alloc(size_t size);
|
||||
static NS_COM void* Realloc(void* ptr, size_t size);
|
||||
static NS_COM void Free(void* ptr);
|
||||
static NS_COM nsresult HeapMinimize(PRBool aImmediate);
|
||||
static NS_COM void* Clone(const void* ptr, size_t size);
|
||||
static NS_COM nsIMemory* GetGlobalMemoryService(); // AddRefs
|
||||
static NS_COM_GLUE void* Alloc(size_t size);
|
||||
static NS_COM_GLUE void* Realloc(void* ptr, size_t size);
|
||||
static NS_COM_GLUE void Free(void* ptr);
|
||||
static NS_COM_GLUE nsresult HeapMinimize(PRBool aImmediate);
|
||||
static NS_COM_GLUE void* Clone(const void* ptr, size_t size);
|
||||
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 {
|
||||
public:
|
||||
static NS_COM void LogAddRef(void* aPtr,
|
||||
nsrefcnt aNewRefCnt,
|
||||
const char* aTypeName,
|
||||
PRUint32 aInstanceSize);
|
||||
static NS_COM_GLUE void LogAddRef(void* aPtr,
|
||||
nsrefcnt aNewRefCnt,
|
||||
const char* aTypeName,
|
||||
PRUint32 aInstanceSize);
|
||||
|
||||
static NS_COM void LogRelease(void* aPtr,
|
||||
nsrefcnt aNewRefCnt,
|
||||
const char* aTypeName);
|
||||
static NS_COM_GLUE void LogRelease(void* aPtr,
|
||||
nsrefcnt aNewRefCnt,
|
||||
const char* aTypeName);
|
||||
|
||||
static NS_COM void LogCtor(void* aPtr, const char* aTypeName,
|
||||
PRUint32 aInstanceSize);
|
||||
static NS_COM_GLUE void LogCtor(void* aPtr, const char* aTypeName,
|
||||
PRUint32 aInstanceSize);
|
||||
|
||||
static NS_COM void LogDtor(void* aPtr, const char* aTypeName,
|
||||
PRUint32 aInstanceSize);
|
||||
static NS_COM_GLUE void LogDtor(void* aPtr, const char* aTypeName,
|
||||
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___ */
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
void* result = 0;
|
||||
|
@ -96,7 +96,7 @@ NS_GetWeakReference( nsISupports* aInstancePtr, nsresult* aErrorPtr )
|
|||
return NS_STATIC_CAST(nsIWeakReference*, result);
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_COM_GLUE nsresult
|
||||
nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr )
|
||||
{
|
||||
if ( !aInstancePtr )
|
||||
|
|
|
@ -50,7 +50,7 @@ class nsWeakReference;
|
|||
#undef IMETHOD_VISIBILITY
|
||||
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
|
||||
|
||||
class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference
|
||||
class NS_COM_GLUE nsSupportsWeakReference : public nsISupportsWeakReference
|
||||
{
|
||||
public:
|
||||
nsSupportsWeakReference()
|
||||
|
@ -85,7 +85,7 @@ class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference
|
|||
#undef IMETHOD_VISIBILITY
|
||||
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
|
||||
|
||||
class NS_COM nsWeakReference : public nsIWeakReference
|
||||
class NS_COM_GLUE nsWeakReference : public nsIWeakReference
|
||||
{
|
||||
public:
|
||||
// nsISupports...
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# 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))
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
GARBAGE += $(addprefix $(srcdir)/,$(XPCOM_GLUE_SRC_LCSRCS))
|
||||
endif
|
||||
|
||||
SRCS_IN_OBJDIR = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
Загрузка…
Ссылка в новой задаче