Bug 698326 - Remove countMe argument to SizeOf in UrlClassifier. r=
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Tue, 15 Nov 2011 18:51:06 +0100
changeset 81962 7197122209faa4af86771921276182d6efa513b4
parent 81961 f76ac3b9fcf2857a34aae6a6dd8266bacce16591
child 81963 2057f46bf229e8057b7e207128edfa4362a7fd50
push idunknown
push userunknown
push dateunknown
bugs698326
milestone11.0a1
Bug 698326 - Remove countMe argument to SizeOf in UrlClassifier. r=
toolkit/components/build/nsToolkitCompsCID.h
toolkit/components/url-classifier/nsIUrlClassifierPrefixSet.idl
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h
--- a/toolkit/components/build/nsToolkitCompsCID.h
+++ b/toolkit/components/build/nsToolkitCompsCID.h
@@ -155,19 +155,19 @@
 // {59648a91-5a60-4122-8ff2-54b839c84aed}
 #define NS_PARENTALCONTROLSSERVICE_CID \
 { 0x580530e5, 0x118c, 0x4bc7, { 0xab, 0x88, 0xbc, 0x2c, 0xd2, 0xb9, 0x72, 0x23 } }
 
 // {e7f70966-9a37-48d7-8aeb-35998f31090e}
 #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 \
 { 0x5eb7c3c1, 0xec1f, 0x4007, { 0x87, 0xcc, 0xee, 0xfb, 0x37, 0xd6, 0x8c, 0xe6} }
 
 // {c2be6dc0-ef1e-4abd-86a2-4f864ddc57f6}
 #define NS_URLCLASSIFIERSTREAMUPDATER_CID \
 { 0xc2be6dc0, 0xef1e, 0x4abd, { 0x86, 0xa2, 0x4f, 0x86, 0x4d, 0xdc, 0x57, 0xf6} }
--- a/toolkit/components/url-classifier/nsIUrlClassifierPrefixSet.idl
+++ b/toolkit/components/url-classifier/nsIUrlClassifierPrefixSet.idl
@@ -36,24 +36,24 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 #include "nsIFile.idl"
 
 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,
                    in unsigned long aLength);
   void addPrefixes([const, array, size_is(aLength)] in unsigned long aPrefixes,
                    in unsigned long aLength);
   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);
   void storeToFile(in nsIFile aFile);
 };
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -3648,17 +3648,17 @@ nsUrlClassifierDBServiceWorker::LoadPref
   }
   if (!exists || NS_FAILED(rv)) {
     LOG(("no (usable) stored PrefixSet found, constructing from store"));
     ConstructPrefixSet();
   }
 
 #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
 #if defined(PR_LOGGING)
   if (LOG_ENABLED()) {
     PRIntervalTime clockEnd = PR_IntervalNow();
     LOG(("Loading took %dms\n",
          PR_IntervalToMilliseconds(clockEnd - clockStart)));
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -122,17 +122,17 @@ nsPrefixSetReporter::GetUnits(PRInt32 * 
   *aUnits = nsIMemoryReporter::UNITS_BYTES;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrefixSetReporter::GetAmount(PRInt64 * aAmount)
 {
   PRUint32 size;
-  nsresult rv = mParent->SizeOfIncludingThis(true, &size);
+  nsresult rv = mParent->SizeOfIncludingThis(&size);
   *aAmount = size;
   return rv;
 }
 
 NS_IMETHODIMP
 nsPrefixSetReporter::GetDescription(nsACString & aDescription)
 {
   aDescription.Assign(NS_LITERAL_CSTRING("Memory used by a PrefixSet for "
@@ -322,25 +322,21 @@ nsUrlClassifierPrefixSet::Contains(PRUin
   if (diff == 0) {
     *aFound = true;
   }
 
   return NS_OK;
 }
 
 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();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsUrlClassifierPrefixSet::IsEmpty(bool * aEmpty)
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h
@@ -67,17 +67,17 @@ public:
   // Does the PrefixSet contain this prefix? not thread-safe
   NS_IMETHOD Contains(PRUint32 aPrefix, bool* aFound);
   // Do a lookup in the PrefixSet
   // if aReady is set, we will block until there are any entries
   // if not set, we will return in aReady whether we were ready or not
   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);
   // Return a key that is used to randomize the collisions in the prefixes
   NS_IMETHOD GetKey(PRUint32* aKey);
 
   NS_DECL_ISUPPORTS