Bug 835503 - Remove nsCycleCollector::ShouldBeFreed/WasFreed, r=mccr8

This commit is contained in:
Olli Pettay
2013-01-29 12:45:38 +02:00
parent 61c27a1843
commit b9ff44f3d6
5 changed files with 1 additions and 83 deletions

View File

@@ -1373,10 +1373,6 @@ nsDocument::~nsDocument()
("DOCUMENT %p destroyed", this));
#endif
#ifdef DEBUG
nsCycleCollector_DEBUG_wasFreed(static_cast<nsIDocument*>(this));
#endif
NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document");
mInDestructor = true;

View File

@@ -1151,10 +1151,6 @@ nsGlobalWindow::~nsGlobalWindow()
CleanUp(true);
#ifdef DEBUG
nsCycleCollector_DEBUG_wasFreed(static_cast<nsIScriptGlobalObject*>(this));
#endif
nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
if (ac)
ac->RemoveWindowAsListener(this);
@@ -1285,9 +1281,6 @@ nsGlobalWindow::CleanUp(bool aIgnoreModalDialog)
mOpener = nullptr; // Forces Release
if (mContext) {
#ifdef DEBUG
nsCycleCollector_DEBUG_shouldBeFreed(mContext);
#endif
mContext = nullptr; // Forces Release
}
mChromeEventHandler = nullptr; // Forces Release
@@ -1321,9 +1314,6 @@ nsGlobalWindow::CleanUp(bool aIgnoreModalDialog)
}
DisableTimeChangeNotifications();
#ifdef DEBUG
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this));
#endif
}
void
@@ -1407,11 +1397,6 @@ nsGlobalWindow::FreeInnerObjects()
mDocBaseURI = mDoc->GetDocBaseURI();
}
#ifdef DEBUG
if (mDocument)
nsCycleCollector_DEBUG_shouldBeFreed(nsCOMPtr<nsISupports>(do_QueryInterface(mDocument)));
#endif
// Remove our reference to the document and the document principal.
mDocument = nullptr;
mDoc = nullptr;
@@ -1432,10 +1417,6 @@ nsGlobalWindow::FreeInnerObjects()
mAudioContexts[i]->Shutdown();
}
mAudioContexts.Clear();
#ifdef DEBUG
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this));
#endif
}
//*****************************************************************************
@@ -2599,11 +2580,6 @@ nsGlobalWindow::DetachFromDocShell()
mContext = nullptr;
}
#ifdef DEBUG
nsCycleCollector_DEBUG_shouldBeFreed(mContext);
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsIScriptGlobalObject*>(this));
#endif
mDocShell = nullptr; // Weak Reference
NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");

View File

@@ -1136,10 +1136,6 @@ nsJSContext::nsJSContext(JSRuntime *aRuntime, bool aGCOnDestruction,
nsJSContext::~nsJSContext()
{
#ifdef DEBUG
nsCycleCollector_DEBUG_wasFreed(static_cast<nsIScriptContext*>(this));
#endif
*mPrev = mNext;
if (mNext) {
mNext->mPrev = mPrev;

View File

@@ -1100,13 +1100,9 @@ struct nsCycleCollector
#ifdef DEBUG_CC
nsCycleCollectorStats mStats;
FILE *mPtrLog;
PointerSet mExpectedGarbage;
bool LogPurpleAddition(void* aObject, nsCycleCollectionParticipant *cp);
void LogPurpleRemoval(void* aObject);
void ShouldBeFreed(nsISupports *n);
void WasFreed(nsISupports *n);
#endif
};
@@ -2545,9 +2541,6 @@ nsCycleCollector::nsCycleCollector() :
mPurpleBuf(mParams)
#endif
{
#ifdef DEBUG_CC
mExpectedGarbage.Init();
#endif
}
@@ -3098,24 +3091,6 @@ nsCycleCollector::Shutdown()
mParams.mDoNothing = true;
}
#ifdef DEBUG_CC
void
nsCycleCollector::ShouldBeFreed(nsISupports *n)
{
if (n) {
mExpectedGarbage.PutEntry(n);
}
}
void
nsCycleCollector::WasFreed(nsISupports *n)
{
if (n) {
mExpectedGarbage.RemoveEntry(n);
}
}
#endif
void
nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
size_t *aObjectSize,
@@ -3140,7 +3115,7 @@ nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
// - mResults: because it's tiny and only contains scalars.
// - mJSRuntime: because it's non-owning and measured by JS reporters.
// - mParams: because it only contains scalars.
// - mStats, mPtrLog, mExpectedGarbage: because they're DEBUG_CC-only.
// - mStats, mPtrLog: because they're DEBUG_CC-only.
}
@@ -3183,26 +3158,6 @@ nsCycleCollector_suspectedCount()
return sCollector ? sCollector->SuspectedCount() : 0;
}
#ifdef DEBUG
void
nsCycleCollector_DEBUG_shouldBeFreed(nsISupports *n)
{
#ifdef DEBUG_CC
if (sCollector)
sCollector->ShouldBeFreed(n);
#endif
}
void
nsCycleCollector_DEBUG_wasFreed(nsISupports *n)
{
#ifdef DEBUG_CC
if (sCollector)
sCollector->WasFreed(n);
#endif
}
#endif
class nsCycleCollectorRunner : public nsRunnable
{
nsCycleCollector *mCollector;

View File

@@ -97,11 +97,6 @@ struct nsCycleCollectionJSRuntime
void nsCycleCollector_registerJSRuntime(nsCycleCollectionJSRuntime *rt);
void nsCycleCollector_forgetJSRuntime();
#ifdef DEBUG
void nsCycleCollector_DEBUG_shouldBeFreed(nsISupports *n);
void nsCycleCollector_DEBUG_wasFreed(nsISupports *n);
#endif
#define NS_CYCLE_COLLECTOR_LOGGER_CID \
{ 0x58be81b4, 0x39d2, 0x437c, \
{ 0x94, 0xea, 0xae, 0xde, 0x2c, 0x62, 0x08, 0xd3 } }