Bug 1636266 - Report XUL Cache StyleSheet Memory r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D74450
This commit is contained in:
Erik Nordin 2020-05-09 01:41:30 +00:00
Родитель 5fff0f03db
Коммит 6b2aad6d2b
2 изменённых файлов: 11 добавлений и 1 удалений

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

@ -504,7 +504,13 @@ void nsXULPrototypeCache::CollectMemoryReports(
// TODO Report content in mPrototypeTable?
other += sInstance->mStyleSheetTable.ShallowSizeOfExcludingThis(mallocSizeOf);
// TODO Report content inside mStyleSheetTable?
for (auto iter = sInstance->mStyleSheetTable.ConstIter(); !iter.Done();
iter.Next()) {
// NOTE: If Loader::DoSheetComplete() is ever modified to stop clongin
// sheets before inserting into this cache, we will need to stop using
// SizeOfIncludingThis()
other += iter.Data()->SizeOfIncludingThis(mallocSizeOf);
}
other += sInstance->mScriptTable.ShallowSizeOfExcludingThis(mallocSizeOf);
// TODO Report content inside mScriptTable?

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

@ -1856,6 +1856,10 @@ void Loader::DoSheetComplete(SheetLoadData& aLoadData,
// We need to clone the sheet on insertion to the cache because
// if the original sheet has a cyclic reference this can cause
// leaks until shutdown since the global cache is not cycle-collected
// NOTE: If we stop cloning sheets before insertion, we need to change
// nsXULPrototypeCache::CollectMemoryReports() to stop using
// SizeOfIncludingThis() because it will no longer own the sheets.
cache->PutStyleSheet(CloneSheet(*sheet));
}
}