Bug 1614610 - Fix missing initialization of CacheIndexStats::mCountByType[] and CacheIndexStats::mSizeByType[] r=valentin

Initialization was missing in CacheIndexStats::CacheIndexStats() and CacheIndexStats::Clear(). Comparison was also added to CacheIndexStats::operator==().

Differential Revision: https://phabricator.services.mozilla.com/D64406

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michal Novotny 2020-02-26 17:16:39 +00:00
parent cb9e7bf077
commit f913f3c0b6

View File

@ -482,9 +482,20 @@ class CacheIndexStats {
mDisableLogging(false)
#endif
{
for (uint32_t i = 0; i < nsICacheEntry::CONTENT_TYPE_LAST; ++i) {
mCountByType[i] = 0;
mSizeByType[i] = 0;
}
}
bool operator==(const CacheIndexStats& aOther) const {
for (uint32_t i = 0; i < nsICacheEntry::CONTENT_TYPE_LAST; ++i) {
if (mCountByType[i] != aOther.mCountByType[i] ||
mSizeByType[i] != aOther.mSizeByType[i]) {
return false;
}
}
return
#ifdef DEBUG
aOther.mStateLogged == mStateLogged &&
@ -516,6 +527,10 @@ class CacheIndexStats {
mFresh = 0;
mEmpty = 0;
mSize = 0;
for (uint32_t i = 0; i < nsICacheEntry::CONTENT_TYPE_LAST; ++i) {
mCountByType[i] = 0;
mSizeByType[i] = 0;
}
}
#ifdef DEBUG