Bug 947798 (part 1) - Rename NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN as MOZ_DEFINE_MALLOC_SIZE_OF. r=mccr8.

--HG--
extra : rebase_source : ec09d4c31264c15befb020375bf001a1ad1df6b8
This commit is contained in:
Nicholas Nethercote 2013-12-07 21:38:32 -08:00
parent e8b3df89dc
commit 6e5e55931d
12 changed files with 29 additions and 30 deletions

View File

@ -642,7 +642,7 @@ nsDOMMemoryFile::DataOwner::sDataOwners;
/* static */ bool
nsDOMMemoryFile::DataOwner::sMemoryReporterRegistered;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMMemoryFileDataOwnerMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(DOMMemoryFileDataOwnerMallocSizeOf)
class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
: public MemoryMultiReporter

View File

@ -113,7 +113,7 @@ WebGLMemoryTracker::~WebGLMemoryTracker()
UnregisterWeakMemoryReporter(this);
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(WebGLBufferMallocSizeOf)
int64_t
WebGLMemoryTracker::GetBufferCacheMemoryUsed() {
@ -131,7 +131,7 @@ WebGLMemoryTracker::GetBufferCacheMemoryUsed() {
return result;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(WebGLShaderMallocSizeOf)
int64_t
WebGLMemoryTracker::GetShaderSize() {

View File

@ -166,7 +166,7 @@ AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr)
}
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WindowsMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(WindowsMallocSizeOf)
// The key is the window ID.
typedef nsDataHashtable<nsUint64HashKey, nsCString> WindowPaths;

View File

@ -94,7 +94,7 @@ using mozilla::AutoSafeJSContext;
USING_WORKERS_NAMESPACE
using namespace mozilla::dom;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsWorkerMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(JsWorkerMallocSizeOf)
namespace {

View File

@ -1360,7 +1360,7 @@ gfxFontFamily::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
* shaped-word caches to free up memory.
*/
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontCacheMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(FontCacheMallocSizeOf)
NS_IMETHODIMP
gfxFontCache::MemoryReporter::CollectReports

View File

@ -71,7 +71,7 @@ gfxFontListPrefObserver::Observe(nsISupports *aSubject,
return NS_OK;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontListMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(FontListMallocSizeOf)
gfxPlatformFontList::MemoryReporter::MemoryReporter()
{}

View File

@ -29,8 +29,8 @@ ImageResource::SizeOfData()
return 0;
// This is not used by memory reporters, but for sizing the cache, which is
// why it uses |moz_malloc_size_of| rather than an
// |NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN|.
// why it uses |moz_malloc_size_of| rather than a
// |MOZ_DEFINE_MALLOC_SIZE_OF|.
return uint32_t(HeapSizeOfSourceWithComputedFallback(moz_malloc_size_of) +
HeapSizeOfDecodedWithComputedFallback(moz_malloc_size_of) +
NonHeapSizeOfDecoded() +

View File

@ -48,7 +48,7 @@
using namespace mozilla;
using namespace mozilla::image;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ImagesMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(ImagesMallocSizeOf)
class imgMemoryReporter MOZ_FINAL : public MemoryMultiReporter
{

View File

@ -1790,7 +1790,7 @@ private:
rtTotal += amount; \
} while (0)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JSMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(JSMallocSizeOf)
namespace xpc {
@ -2436,7 +2436,7 @@ class JSMainRuntimeCompartmentsReporter MOZ_FINAL : public MemoryMultiReporter
}
};
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(OrphanMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(OrphanMallocSizeOf)
namespace xpc {

View File

@ -386,8 +386,8 @@ namespace {
// how much memory SQLite is using. And we can compare that against what
// SQLite reports it is using.
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(SqliteMallocSizeOfOnAlloc)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(SqliteMallocSizeOfOnFree)
MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(SqliteMallocSizeOfOnAlloc)
MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree)
#endif

View File

@ -250,7 +250,7 @@ nsUrlClassifierPrefixSet::Contains(uint32_t aPrefix, bool* aFound)
return NS_OK;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(UrlClassifierMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(UrlClassifierMallocSizeOf)
NS_IMETHODIMP
nsUrlClassifierPrefixSet::CollectReports(nsIHandleReportCallback* aHandleReport,

View File

@ -466,13 +466,12 @@ void RunReporters();
// will always be zero on some obscure platforms.
//
// You might be wondering why we have a macro that creates multiple functions
// that differ only in their name, instead of a single
// MemoryReporterMallocSizeOf function. It's mostly to help with DMD
// integration, though it sometimes also helps with debugging and temporary ad
// hoc profiling. The function name chosen doesn't matter greatly, but it's
// best to make it similar to the path used by the relevant memory
// reporter(s).
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(fn) \
// that differ only in their name, instead of a single MallocSizeOf function.
// It's mostly to help with DMD integration, though it sometimes also helps
// with debugging and temporary ad hoc profiling. The function name chosen
// doesn't matter greatly, but it's best to make it similar to the path used by
// the relevant memory reporter(s).
#define MOZ_DEFINE_MALLOC_SIZE_OF(fn) \
static size_t fn(const void* aPtr) \
{ \
MOZ_REPORT(aPtr); \
@ -484,13 +483,13 @@ void RunReporters();
// unreport them as soon as they are freed. Such allocators are used in cases
// where we have third-party code that we cannot modify. The two functions
// must always be used in tandem.
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(fn) \
#define MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(fn) \
static size_t fn(const void* aPtr) \
{ \
MOZ_REPORT_ON_ALLOC(aPtr); \
return moz_malloc_size_of(aPtr); \
}
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(fn) \
#define MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(fn) \
static size_t fn(const void* aPtr) \
{ \
return moz_malloc_size_of(aPtr); \
@ -555,9 +554,9 @@ protected:
return 0;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(MallocSizeOf)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(MallocSizeOfOnAlloc)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(MallocSizeOfOnFree)
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(MallocSizeOfOnAlloc)
MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(MallocSizeOfOnFree)
const nsCString mPath;
const int32_t mKind;
@ -590,9 +589,9 @@ public:
nsISupports* aClosure) = 0;
protected:
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(MallocSizeOf)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(MallocSizeOfOnAlloc)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(MallocSizeOfOnFree)
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(MallocSizeOfOnAlloc)
MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(MallocSizeOfOnFree)
};
} // namespace mozilla