Bug 698326 - Remove countMe argument to SizeOf in UrlClassifier. r=

This commit is contained in:
Gian-Carlo Pascutto 2011-11-15 18:51:06 +01:00
parent b76df8b343
commit c6a502a2d1
5 changed files with 10 additions and 14 deletions

View File

@ -160,9 +160,9 @@
#define NS_TYPEAHEADFIND_CID \
{ 0xe7f70966, 0x9a37, 0x48d7, { 0x8a, 0xeb, 0x35, 0x99, 0x8f, 0x31, 0x09, 0x0e} }
// {5edc87c2-6960-44e5-8431-bdfbb56f6aff}
// {51464459-4e46-4f31-8745-4acfa7c1e2f2}
#define NS_URLCLASSIFIERPREFIXSET_CID \
{ 0x5edc87c2, 0x6960, 0x44e5, { 0x84, 0x31, 0xbd, 0xfb, 0xb5, 0x6f, 0x6a, 0xff} }
{ 0x51464459, 0x4e46, 0x4f31, { 0x87, 0x45, 0x4a, 0xcf, 0xa7, 0xc1, 0xe2, 0xf2} }
// {5eb7c3c1-ec1f-4007-87cc-eefb37d68ce6}
#define NS_URLCLASSIFIERDBSERVICE_CID \

View File

@ -41,7 +41,7 @@
interface nsIArray;
[scriptable, uuid(5edc87c2-6960-44e5-8431-bdfbb56f6aff)]
[scriptable, uuid(51464459-4e46-4f31-8745-4acfa7c1e2f2)]
interface nsIUrlClassifierPrefixSet : nsISupports
{
void setPrefixes([const, array, size_is(aLength)] in unsigned long aPrefixes,
@ -51,7 +51,7 @@ interface nsIUrlClassifierPrefixSet : nsISupports
boolean contains(in unsigned long aPrefix);
boolean probe(in unsigned long aPrefix, in unsigned long aKey,
inout boolean aReady);
PRUint32 sizeOfIncludingThis(in boolean aCountMe);
PRUint32 sizeOfIncludingThis();
PRUint32 getKey();
boolean isEmpty();
void loadFromFile(in nsIFile aFile);

View File

@ -3653,7 +3653,7 @@ nsUrlClassifierDBServiceWorker::LoadPrefixSet(nsCOMPtr<nsIFile> & aFile)
#ifdef DEBUG
PRUint32 size = 0;
rv = mPrefixSet->SizeOfIncludingThis(true, &size);
rv = mPrefixSet->SizeOfIncludingThis(&size);
LOG(("SB tree done, size = %d bytes\n", size));
NS_ENSURE_SUCCESS(rv, rv);
#endif

View File

@ -127,7 +127,7 @@ NS_IMETHODIMP
nsPrefixSetReporter::GetAmount(PRInt64 * aAmount)
{
PRUint32 size;
nsresult rv = mParent->SizeOfIncludingThis(true, &size);
nsresult rv = mParent->SizeOfIncludingThis(&size);
*aAmount = size;
return rv;
}
@ -327,15 +327,11 @@ nsUrlClassifierPrefixSet::Contains(PRUint32 aPrefix, bool * aFound)
}
NS_IMETHODIMP
nsUrlClassifierPrefixSet::SizeOfIncludingThis(bool aCountMe, PRUint32 * aSize)
nsUrlClassifierPrefixSet::SizeOfIncludingThis(PRUint32 * aSize)
{
MutexAutoLock lock(mPrefixSetLock);
if (aCountMe) {
size_t usable = moz_malloc_usable_size(this);
*aSize = (PRUint32)(usable ? usable : sizeof(*this));
} else {
*aSize = 0;
}
size_t usable = moz_malloc_usable_size(this);
*aSize = (PRUint32)(usable ? usable : sizeof(*this));
*aSize += mDeltas.SizeOf();
*aSize += mIndexPrefixes.SizeOf();
*aSize += mIndexStarts.SizeOf();

View File

@ -72,7 +72,7 @@ public:
NS_IMETHOD Probe(PRUint32 aPrefix, PRUint32 aKey, bool* aReady, bool* aFound);
// Return the estimated size of the set on disk and in memory,
// in bytes
NS_IMETHOD SizeOfIncludingThis(bool aCountMe, PRUint32* aSize);
NS_IMETHOD SizeOfIncludingThis(PRUint32* aSize);
NS_IMETHOD IsEmpty(bool * aEmpty);
NS_IMETHOD LoadFromFile(nsIFile* aFile);
NS_IMETHOD StoreToFile(nsIFile* aFile);