Bug 1050108 - Remove superfluous member variables in PrefixSet. r=mmc

This commit is contained in:
Gian-Carlo Pascutto 2014-10-14 13:16:11 +02:00
parent 9176ca811b
commit 8049ee3516
2 changed files with 4 additions and 13 deletions

View File

@ -41,8 +41,7 @@ NS_IMPL_ISUPPORTS(
MOZ_DEFINE_MALLOC_SIZE_OF(UrlClassifierMallocSizeOf)
nsUrlClassifierPrefixSet::nsUrlClassifierPrefixSet()
: mHasPrefixes(false)
, mTotalPrefixes(0)
: mTotalPrefixes(0)
, mMemoryInUse(0)
, mMemoryReportPath()
{
@ -77,12 +76,11 @@ nsUrlClassifierPrefixSet::SetPrefixes(const uint32_t* aArray, uint32_t aLength)
nsresult rv = NS_OK;
if (aLength <= 0) {
if (mHasPrefixes) {
if (mIndexPrefixes.Length() > 0) {
LOG(("Clearing PrefixSet"));
mIndexDeltas.Clear();
mIndexPrefixes.Clear();
mTotalPrefixes = 0;
mHasPrefixes = false;
}
} else {
rv = MakePrefixSet(aArray, aLength);
@ -139,8 +137,6 @@ nsUrlClassifierPrefixSet::MakePrefixSet(const uint32_t* aPrefixes, uint32_t aLen
LOG(("Total number of deltas: %d", totalDeltas));
LOG(("Total number of delta chunks: %d", mIndexDeltas.Length()));
mHasPrefixes = true;
return NS_OK;
}
@ -201,7 +197,7 @@ nsUrlClassifierPrefixSet::Contains(uint32_t aPrefix, bool* aFound)
{
*aFound = false;
if (!mHasPrefixes) {
if (mIndexPrefixes.Length() == 0) {
return NS_OK;
}
@ -270,7 +266,7 @@ nsUrlClassifierPrefixSet::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeO
NS_IMETHODIMP
nsUrlClassifierPrefixSet::IsEmpty(bool * aEmpty)
{
*aEmpty = !mHasPrefixes;
*aEmpty = (mIndexPrefixes.Length() == 0);
return NS_OK;
}
@ -328,8 +324,6 @@ nsUrlClassifierPrefixSet::LoadFromFd(AutoFDClose& fileFd)
NS_ENSURE_TRUE(read == toRead, NS_ERROR_FILE_CORRUPTED);
}
}
mHasPrefixes = true;
} else {
LOG(("Version magic mismatch, not loading"));
return NS_ERROR_FILE_CORRUPTED;

View File

@ -56,9 +56,6 @@ protected:
// Return the estimated size of the set on disk and in memory, in bytes.
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
// boolean indicating whether |setPrefixes| has been
// called with a non-empty array.
bool mHasPrefixes;
// list of fully stored prefixes, that also form the
// start of a run of deltas in mIndexDeltas.
nsTArray<uint32_t> mIndexPrefixes;