Bug 948201 - Use a StaticRefPtr for gInterfaceInfoManager. r=bz.

--HG--
extra : rebase_source : be06bb4b77914dd1a5ae2a7e1cced40fcd5850f5
This commit is contained in:
Nicholas Nethercote 2013-12-07 21:41:32 -08:00
parent 8df7cf946b
commit 01579d525d

View File

@ -10,6 +10,7 @@
#include "mozilla/FileUtils.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StaticPtr.h"
#include "xptiprivate.h"
#include "nsDependentString.h"
@ -26,10 +27,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(
MemoryUniReporter,
nsIInterfaceInfoManager)
static XPTInterfaceInfoManager* gInterfaceInfoManager = nullptr;
#ifdef DEBUG
static int gCallCount = 0;
#endif
static StaticRefPtr<XPTInterfaceInfoManager> gInterfaceInfoManager;
size_t
XPTInterfaceInfoManager::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
@ -62,7 +60,6 @@ XPTInterfaceInfoManager::GetSingleton()
{
if (!gInterfaceInfoManager) {
gInterfaceInfoManager = new XPTInterfaceInfoManager();
NS_ADDREF(gInterfaceInfoManager);
gInterfaceInfoManager->InitMemoryReporter();
}
return gInterfaceInfoManager;
@ -71,7 +68,7 @@ XPTInterfaceInfoManager::GetSingleton()
void
XPTInterfaceInfoManager::FreeInterfaceInfoManager()
{
NS_IF_RELEASE(gInterfaceInfoManager);
gInterfaceInfoManager = nullptr;
}
XPTInterfaceInfoManager::XPTInterfaceInfoManager()
@ -88,11 +85,6 @@ XPTInterfaceInfoManager::~XPTInterfaceInfoManager()
mWorkingSet.InvalidateInterfaceInfos();
UnregisterWeakMemoryReporter(this);
gInterfaceInfoManager = nullptr;
#ifdef DEBUG
gCallCount = 0;
#endif
}
void