Bug 936964 (part 7) - Make lots of classes report their own memory consumption, instead of using a separate reporter class. r=mccr8,sr=bz.

This commit is contained in:
Nicholas Nethercote
2013-11-07 16:35:30 +11:00
parent d4ede6d933
commit c363b9d028
68 changed files with 917 additions and 1070 deletions

View File

@@ -10,6 +10,7 @@
#include "nsISupportsUtils.h"
#include "nsID.h"
#include "nsIFile.h"
#include "nsIMemoryReporter.h"
#include "nsIMutableArray.h"
#include "nsIUrlClassifierPrefixSet.h"
#include "nsTArray.h"
@@ -19,9 +20,9 @@
#include "mozilla/CondVar.h"
#include "mozilla/FileUtils.h"
class nsIMemoryReporter;
class nsUrlClassifierPrefixSet : public nsIUrlClassifierPrefixSet
class nsUrlClassifierPrefixSet
: public nsIUrlClassifierPrefixSet
, public nsIMemoryReporter
{
public:
nsUrlClassifierPrefixSet();
@@ -35,10 +36,10 @@ public:
NS_IMETHOD LoadFromFile(nsIFile* aFile);
NS_IMETHOD StoreToFile(nsIFile* aFile);
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
// Return the estimated size of the set on disk and in memory,
// in bytes
// Return the estimated size of the set on disk and in memory, in bytes.
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
protected:
@@ -46,8 +47,6 @@ protected:
static const uint32_t MAX_INDEX_DIFF = (1 << 16);
static const uint32_t PREFIXSET_VERSION_MAGIC = 1;
nsCOMPtr<nsIMemoryReporter> mReporter;
nsresult MakePrefixSet(const uint32_t* aArray, uint32_t aLength);
uint32_t BinSearch(uint32_t start, uint32_t end, uint32_t target);
nsresult LoadFromFd(mozilla::AutoFDClose& fileFd);
@@ -63,6 +62,8 @@ protected:
FallibleTArray<uint32_t> mIndexStarts;
// array containing deltas from indices.
FallibleTArray<uint16_t> mDeltas;
nsCString mMemoryReportPath;
};
#endif