зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1745972 - Check if CacheIndexRecordWrapper is still in mFrecencyArray, r=necko-reviewers,valentin
The idea in this patch is like D99680, but the difference is that mFrecencyArray now contains CacheIndexRecordWrapper. This should be able to help us track why CacheIndexRecordWrapper is released before removing it from mFrecencyArray. Differential Revision: https://phabricator.services.mozilla.com/D139469
This commit is contained in:
Родитель
9edb713993
Коммит
ca859523ff
|
@ -72,6 +72,17 @@ class FrecencyComparator {
|
|||
|
||||
} // namespace
|
||||
|
||||
CacheIndexRecordWrapper::~CacheIndexRecordWrapper() {
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
CacheIndex::sLock.AssertCurrentThreadOwns();
|
||||
RefPtr<CacheIndex> index = CacheIndex::gInstance;
|
||||
if (index) {
|
||||
bool found = index->mFrecencyArray.RecordExistedUnlocked(this);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!found);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This helper class is responsible for keeping CacheIndex::mIndexStats and
|
||||
* CacheIndex::mFrecencyArray up to date.
|
||||
|
@ -3372,6 +3383,11 @@ void CacheIndex::FrecencyArray::SortIfNeeded(
|
|||
}
|
||||
}
|
||||
|
||||
bool CacheIndex::FrecencyArray::RecordExistedUnlocked(
|
||||
CacheIndexRecordWrapper* aRecord) {
|
||||
return mRecs.Contains(aRecord);
|
||||
}
|
||||
|
||||
void CacheIndex::AddRecordToIterators(CacheIndexRecordWrapper* aRecord,
|
||||
const StaticMutexAutoLock& aProofOfLock) {
|
||||
for (uint32_t i = 0; i < mIterators.Length(); ++i) {
|
||||
|
|
|
@ -116,7 +116,7 @@ class CacheIndexRecordWrapper final {
|
|||
CacheIndexRecord* Get() { return mRec.get(); }
|
||||
|
||||
private:
|
||||
~CacheIndexRecordWrapper() = default;
|
||||
~CacheIndexRecordWrapper();
|
||||
UniquePtr<CacheIndexRecord> mRec;
|
||||
};
|
||||
|
||||
|
@ -812,7 +812,7 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
friend class CacheIndexEntryAutoManage;
|
||||
friend class FileOpenHelper;
|
||||
friend class CacheIndexIterator;
|
||||
friend struct CacheIndexRecord;
|
||||
friend class CacheIndexRecordWrapper;
|
||||
|
||||
virtual ~CacheIndex();
|
||||
|
||||
|
@ -1196,6 +1196,7 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
CacheIndexRecordWrapper* aNewRecord,
|
||||
const StaticMutexAutoLock& aProofOfLock);
|
||||
void SortIfNeeded(const StaticMutexAutoLock& aProofOfLock);
|
||||
bool RecordExistedUnlocked(CacheIndexRecordWrapper* aRecord);
|
||||
|
||||
size_t Length() const { return mRecs.Length() - mRemovedElements; }
|
||||
void Clear(const StaticMutexAutoLock& aProofOfLock) { mRecs.Clear(); }
|
||||
|
|
Загрузка…
Ссылка в новой задаче