nsBaseHashtable::SizeOfExcludingThis and SizeOfIncludingThis can't be instantiated
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
People
(Reporter: janv, Unassigned)
References
Details
These methods can't be instantiated because nsBaseHashtableET
currently lacks SizeOfExcludingThis/SizeOfIncludingThis implementation.
Comment 1•2 years ago
•
|
||
I tried the obvious thing here:
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
return KeyClass::SizeOfExcludingThis(aMallocSizeOf) +
mData.SizeOfExcludingThis(mData);
}
(SizeOfIncludingThis isn't needed because the storage of the entry will be accounted for by the hashtable itself.)
Unfortunately, this isn't sufficient. We need to also handle the case where SizeOfExcludingThis is defined for only the key or only the data. The alternative would be to make people define useless SizeOfExcludingThis methods for classes that don't entrain any storage, but that sounds really annoying.
We even already rely on this, for the field CacheStorageService::mPurgeTimeStamps
, which has type nsTHashMap<nsCStringHashKey, mozilla::TimeStamp>
. This works right now because nsBaseHashtableET inherits from the key type, and nsCStringHashKey has a SizeOfExcludingThis method defined.
Description
•