initialization/shutdown code for GC leak detector. conditionalized on GC_LEAK_DETECTOR. r=sfraser

This commit is contained in:
beard%netscape.com 1999-09-30 07:41:37 +00:00
Родитель ed5ef54678
Коммит f6b231af47
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -148,11 +148,21 @@ nsIServiceManager* nsServiceManager::mGlobalServiceManager = NULL;
nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = NULL; nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = NULL;
static nsFileSpec registryDirName; static nsFileSpec registryDirName;
#ifdef GC_LEAK_DETECTOR
extern "C" void NSInitGarbageCollector(void);
extern "C" void NSShutdownGarbageCollector(void);
#endif
nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result, nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result,
nsFileSpec *registryFile, nsFileSpec *componentDir) nsFileSpec *registryFile, nsFileSpec *componentDir)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
#ifdef GC_LEAK_DETECTOR
// 0. Initialize the GC.
NSInitGarbageCollector();
#endif
// 1. Create the Global Service Manager // 1. Create the Global Service Manager
nsIServiceManager* servMgr = NULL; nsIServiceManager* servMgr = NULL;
if (nsServiceManager::mGlobalServiceManager == NULL) if (nsServiceManager::mGlobalServiceManager == NULL)
@ -457,6 +467,12 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
extern void _FreeAutoLockStatics(); extern void _FreeAutoLockStatics();
_FreeAutoLockStatics(); _FreeAutoLockStatics();
#endif #endif
#ifdef GC_LEAK_DETECTOR
// Shutdown the GC.
NSShutdownGarbageCollector();
#endif
return NS_OK; return NS_OK;
} }