Bug 392873. Add debugging code to help track down a crash in the bfcache-expiry code. r+sr=bzbarsky,a=damon
git-svn-id: svn://10.0.0.236/trunk@236961 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -160,6 +160,14 @@ nsSHEntry::~nsSHEntry()
|
||||
if (viewer) {
|
||||
viewer->Destroy();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsExpirationTracker<nsSHEntry,3>::Iterator iterator(gHistoryTracker);
|
||||
nsSHEntry* elem;
|
||||
while ((elem = iterator.Next()) != nsnull) {
|
||||
NS_ASSERTION(elem != this, "Found dead entry still in the tracker!");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
||||
@@ -234,6 +234,29 @@ template <class T, PRUint32 K> class nsExpirationTracker {
|
||||
AgeOneGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
class Iterator {
|
||||
private:
|
||||
nsExpirationTracker<T,K>* mTracker;
|
||||
PRUint32 mGeneration;
|
||||
PRUint32 mIndex;
|
||||
public:
|
||||
Iterator(nsExpirationTracker<T,K>* aTracker)
|
||||
: mTracker(aTracker), mGeneration(0), mIndex(0) {}
|
||||
T* Next() {
|
||||
while (mGeneration < K) {
|
||||
nsTArray<T*>* generation = &mTracker->mGenerations[mGeneration];
|
||||
if (mIndex < generation->Length()) {
|
||||
++mIndex;
|
||||
return (*generation)[mIndex - 1];
|
||||
}
|
||||
++mGeneration;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
};
|
||||
|
||||
friend class Iterator;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user