Bug 819819 (part 2) - Remove |name| from NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN. r=jlebar.

--HG--
rename : dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html => dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing.html
rename : toolkit/components/places/tests/browser/browser_favicon_privatebrowsing_perwindowpb.js => toolkit/components/places/tests/browser/browser_favicon_privatebrowsing.js
extra : rebase_source : 557cc60522970ce7eea3b006d357284d9b4694c4
This commit is contained in:
Nicholas Nethercote 2012-12-23 16:59:51 -08:00
parent 2e4cba0da3
commit acc80a9abd
27 changed files with 56 additions and 68 deletions

View File

@ -615,8 +615,7 @@ nsDOMMemoryFile::DataOwner::sDataOwners;
/* static */ bool
nsDOMMemoryFile::DataOwner::sMemoryReporterRegistered;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMMemoryFileDataOwnerSizeOf,
"memory-file-data");
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMMemoryFileDataOwnerMallocSizeOf)
class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
: public nsIMemoryMultiReporter
@ -651,7 +650,7 @@ class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
for (DataOwner *owner = DataOwner::sDataOwners->getFirst();
owner; owner = owner->getNext()) {
size_t size = DOMMemoryFileDataOwnerSizeOf(owner->mData);
size_t size = DOMMemoryFileDataOwnerMallocSizeOf(owner->mData);
if (size < LARGE_OBJECT_MIN_SIZE) {
smallObjectsTotal += size;

View File

@ -140,7 +140,7 @@ WebGLMemoryMultiReporterWrapper::~WebGLMemoryMultiReporterWrapper()
NS_UnregisterMemoryMultiReporter(mReporter);
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOfFun, "webgl-buffer")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOf)
int64_t
WebGLMemoryMultiReporterWrapper::GetBufferCacheMemoryUsed() {
@ -152,13 +152,13 @@ WebGLMemoryMultiReporterWrapper::GetBufferCacheMemoryUsed() {
buffer = buffer->getNext())
{
if (buffer->Target() == LOCAL_GL_ELEMENT_ARRAY_BUFFER)
result += buffer->SizeOfIncludingThis(WebGLBufferMallocSizeOfFun);
result += buffer->SizeOfIncludingThis(WebGLBufferMallocSizeOf);
}
}
return result;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOfFun, "webgl-shader")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOf)
int64_t
WebGLMemoryMultiReporterWrapper::GetShaderSize() {
@ -169,7 +169,7 @@ WebGLMemoryMultiReporterWrapper::GetShaderSize() {
shader;
shader = shader->getNext())
{
result += shader->SizeOfIncludingThis(WebGLShaderMallocSizeOfFun);
result += shader->SizeOfIncludingThis(WebGLShaderMallocSizeOf);
}
}
return result;

View File

@ -177,8 +177,7 @@ static nsJSContext *sContextList = nullptr;
static nsScriptNameSpaceManager *gNameSpaceManager;
static nsIMemoryReporter *gReporter;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ScriptNameSpaceManagerMallocSizeOf,
"script-namespace-manager")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ScriptNameSpaceManagerMallocSizeOf)
static int64_t
GetScriptNameSpaceManagerSize()

View File

@ -105,7 +105,7 @@ AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr)
}
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMStyleMallocSizeOf, "windows")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WindowsMallocSizeOf)
// The key is the window ID.
typedef nsDataHashtable<nsUint64HashKey, nsCString> WindowPaths;
@ -166,7 +166,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
} \
} while (0)
nsWindowSizes windowSizes(DOMStyleMallocSizeOf);
nsWindowSizes windowSizes(WindowsMallocSizeOf);
aWindow->SizeOfIncludingThis(&windowSizes);
REPORT("/dom/other", windowSizes.mDOMOther,

View File

@ -80,7 +80,7 @@ USING_WORKERS_NAMESPACE
using namespace mozilla::dom::workers::events;
using namespace mozilla::dom;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsWorkerMallocSizeOf, "js-worker")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsWorkerMallocSizeOf)
namespace {

View File

@ -98,7 +98,7 @@ NS_IMPL_CYCLE_COLLECTION_3(mozHunspell,
// Memory reporting stuff.
static int64_t gHunspellAllocatedSize = 0;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(HunspellMallocSizeOfOnAlloc, "hunspell")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(HunspellMallocSizeOfOnAlloc)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(HunspellMallocSizeOfOnFree)
void HunspellReportMemoryAllocation(void* ptr) {

View File

@ -46,7 +46,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(Freetype,
"Memory used by Freetype."
)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(FreetypeMallocSizeOfOnAlloc, "freetype")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(FreetypeMallocSizeOfOnAlloc)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(FreetypeMallocSizeOfOnFree)
static void*

View File

@ -1129,7 +1129,7 @@ gfxFontFamily::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
NS_IMPL_ISUPPORTS1(gfxFontCache::MemoryReporter, nsIMemoryMultiReporter)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontCacheMallocSizeOf, "font-cache")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontCacheMallocSizeOf)
NS_IMETHODIMP
gfxFontCache::MemoryReporter::GetName(nsACString &aName)

View File

@ -72,7 +72,7 @@ gfxFontListPrefObserver::Observe(nsISupports *aSubject,
NS_IMPL_ISUPPORTS1(gfxPlatformFontList::MemoryReporter, nsIMemoryMultiReporter)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontListMallocSizeOf, "font-list")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontListMallocSizeOf)
NS_IMETHODIMP
gfxPlatformFontList::MemoryReporter::GetName(nsACString &aName)

View File

@ -64,7 +64,7 @@
using namespace mozilla;
using namespace mozilla::image;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ImagesMallocSizeOf, "images")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ImagesMallocSizeOf)
class imgMemoryReporter MOZ_FINAL :
public nsIMemoryMultiReporter

View File

@ -1482,7 +1482,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSUserCompartmentCount,
rtTotal += amount; \
} while (0)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsMallocSizeOf, "js")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsMallocSizeOf)
namespace xpc {
@ -1979,16 +1979,16 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(JSCompartmentsMultiReporter
, nsIMemoryMultiReporter
)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(OrphanSizeOf, "orphans")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(OrphanMallocSizeOf)
namespace xpc {
static size_t
SizeOfTreeIncludingThis(nsINode *tree)
{
size_t n = tree->SizeOfIncludingThis(OrphanSizeOf);
size_t n = tree->SizeOfIncludingThis(OrphanMallocSizeOf);
for (nsIContent* child = tree->GetFirstChild(); child; child = child->GetNextNode(tree)) {
n += child->SizeOfIncludingThis(OrphanSizeOf);
n += child->SizeOfIncludingThis(OrphanMallocSizeOf);
}
return n;
}

View File

@ -21,8 +21,7 @@
#include "nsLayoutStatics.h"
#include "nsIMemoryReporter.h"
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(LayoutStyleSheetServiceMallocSizeOf,
"layout/style-sheet-service")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(LayoutStyleSheetServiceMallocSizeOf)
static int64_t
GetStyleSheetServiceSize()

View File

@ -16,8 +16,7 @@
#include "nsIXULRuntime.h"
#include "nsCSSStyleSheet.h"
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(LayoutStyleSheetCacheMallocSizeOf,
"layout/style-sheet-cache")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(LayoutStyleSheetCacheMallocSizeOf)
static int64_t
GetStylesheetCacheSize()

View File

@ -158,7 +158,7 @@ static nsTArray<nsAutoPtr<CacheData> >* gCacheData = nullptr;
static nsRefPtrHashtable<ValueObserverHashKey,
ValueObserver>* gObserverTable = nullptr;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(PreferencesMallocSizeOf, "preferences")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(PreferencesMallocSizeOf)
static size_t
SizeOfObserverEntryExcludingThis(ValueObserverHashKey* aKey,

View File

@ -1080,7 +1080,7 @@ NS_THREADSAFE_MEMORY_REPORTER_IMPLEMENT(NetworkMemoryCache,
nsCacheService::MemoryDeviceSize,
"Memory used by the network memory cache.")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(NetworkDiskCacheSizeOfFun, "network-disk-cache")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(NetworkDiskCacheMallocSizeOf)
static nsCOMPtr<nsIMemoryReporter> DiskCacheReporter = nullptr;
@ -2288,7 +2288,7 @@ nsCacheService::DiskDeviceHeapSize()
{
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_DISKDEVICEHEAPSIZE));
nsDiskCacheDevice *diskDevice = GlobalInstance()->mDiskDevice;
return (int64_t)(diskDevice ? diskDevice->SizeOfIncludingThis(NetworkDiskCacheSizeOfFun) : 0);
return (int64_t)(diskDevice ? diskDevice->SizeOfIncludingThis(NetworkDiskCacheMallocSizeOf) : 0);
}
nsresult

View File

@ -59,8 +59,7 @@ nsDomainEntry::FuncForStaticAsserts(void)
static nsEffectiveTLDService *gService = nullptr;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(EffectiveTLDServiceMallocSizeOf,
"effective-tld-service")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(EffectiveTLDServiceMallocSizeOf)
static int64_t
GetEffectiveTLDSize()

View File

@ -66,7 +66,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(StartupCacheMapping,
"Memory used to hold the mapping of the startup cache from file. This "
"memory is likely to be swapped out shortly after start-up.")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(StartupCacheDataMallocSizeOf, "startup-cache/data")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(StartupCacheDataMallocSizeOf)
static int64_t
GetStartupCacheDataSize()

View File

@ -470,8 +470,8 @@ namespace {
// sqlite is fully and correctly accounting for all of its heap blocks via its
// own memory accounting.
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(sqliteMallocSizeOfOnAlloc, "sqlite")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(sqliteMallocSizeOfOnFree)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(SqliteMallocSizeOfOnAlloc)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(SqliteMallocSizeOfOnFree)
#endif
@ -479,7 +479,7 @@ static void *sqliteMemMalloc(int n)
{
void* p = ::moz_malloc(n);
#ifdef MOZ_DMD
sqliteMallocSizeOfOnAlloc(p);
SqliteMallocSizeOfOnAlloc(p);
#endif
return p;
}
@ -487,7 +487,7 @@ static void *sqliteMemMalloc(int n)
static void sqliteMemFree(void *p)
{
#ifdef MOZ_DMD
sqliteMallocSizeOfOnFree(p);
SqliteMallocSizeOfOnFree(p);
#endif
::moz_free(p);
}
@ -495,13 +495,13 @@ static void sqliteMemFree(void *p)
static void *sqliteMemRealloc(void *p, int n)
{
#ifdef MOZ_DMD
sqliteMallocSizeOfOnFree(p);
SqliteMallocSizeOfOnFree(p);
void *pnew = ::moz_realloc(p, n);
if (pnew) {
sqliteMallocSizeOfOnAlloc(pnew);
SqliteMallocSizeOfOnAlloc(pnew);
} else {
// realloc failed; undo the sqliteMallocSizeOfOnFree from above
sqliteMallocSizeOfOnAlloc(p);
// realloc failed; undo the SqliteMallocSizeOfOnFree from above
SqliteMallocSizeOfOnAlloc(p);
}
return pnew;
#else

View File

@ -1402,8 +1402,7 @@ StoreAndNotifyEmbedVisit(VisitData& aPlace,
(void)NS_DispatchToMainThread(event);
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(HistoryLinksHashtableMallocSizeOf,
"history-links-hashtable")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(HistoryLinksHashtableMallocSizeOf)
int64_t GetHistoryObserversSize()
{

View File

@ -329,7 +329,7 @@ private:
TelemetryImpl* TelemetryImpl::sTelemetry = NULL;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(TelemetryMallocSizeOf, "telemetry")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(TelemetryMallocSizeOf)
size_t
TelemetryImpl::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)

View File

@ -49,8 +49,7 @@ private:
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPrefixSetReporter, nsIMemoryReporter)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(StoragePrefixSetMallocSizeOf,
"storage/prefixset")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(StoragePrefixSetMallocSizeOf)
nsPrefixSetReporter::nsPrefixSetReporter(nsUrlClassifierPrefixSet* aParent,
const nsACString& aName)

View File

@ -3026,8 +3026,7 @@ nsCycleCollector::WasFreed(nsISupports *n)
// Memory reporter
////////////////////////
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(CycleCollectorMallocSizeOf,
"cycle-collector")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(CycleCollectorMallocSizeOf)
void
nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,

View File

@ -376,13 +376,13 @@ void RunReporters();
#include "DMD.h"
#define MOZ_REPORT(ptr, usable, name) mozilla::dmd::Report(ptr)
#define MOZ_REPORT_ON_ALLOC(ptr, usable, name) mozilla::dmd::ReportOnAlloc(ptr)
#define MOZ_REPORT(ptr) mozilla::dmd::Report(ptr)
#define MOZ_REPORT_ON_ALLOC(ptr) mozilla::dmd::ReportOnAlloc(ptr)
#else
#define MOZ_REPORT(ptr, usable, name)
#define MOZ_REPORT_ON_ALLOC(ptr, usable, name)
#define MOZ_REPORT(ptr)
#define MOZ_REPORT_ON_ALLOC(ptr)
#endif // defined(MOZ_DMD)
@ -390,19 +390,18 @@ void RunReporters();
// memory reporters. Such functions return |moz_malloc_size_of(ptr)|; this
// will always be zero on some obscure platforms.
//
// You might be wondering why we have a macro that creates multiple
// functions distinguished only by |name|, instead of a single
// 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 |name| chosen doesn't matter greatly, but it's
// 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, name) \
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(fn) \
static size_t fn(const void *ptr) \
{ \
size_t usable = moz_malloc_size_of(ptr); \
MOZ_REPORT(ptr, usable, name); \
return usable; \
MOZ_REPORT(ptr); \
return moz_malloc_size_of(ptr); \
}
// Functions generated by the next two macros should be used by wrapping
@ -410,12 +409,11 @@ 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, name) \
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_ALLOC_FUN(fn) \
static size_t fn(const void *ptr) \
{ \
size_t usable = moz_malloc_size_of(ptr); \
MOZ_REPORT_ON_ALLOC(ptr, usable, name); \
return usable; \
MOZ_REPORT_ON_ALLOC(ptr); \
return moz_malloc_size_of(ptr); \
}
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(fn) \
static size_t fn(const void *ptr) \

View File

@ -543,7 +543,7 @@ NS_FALLIBLE_MEMORY_REPORTER_IMPLEMENT(Explicit,
"different results.")
#endif // HAVE_JEMALLOC_STATS
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(AtomTableMallocSizeOf, "atom-table")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(AtomTableMallocSizeOf)
static int64_t GetAtomTableSize() {
return NS_SizeOfAtomTablesIncludingThis(AtomTableMallocSizeOf);

View File

@ -401,8 +401,7 @@ CategoryEnumerator::enumfunc_createenumerator(const char* aStr, CategoryNode* aN
NS_IMPL_QUERY_INTERFACE1(nsCategoryManager, nsICategoryManager)
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(CategoryManagerMallocSizeOf,
"category-manager")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(CategoryManagerMallocSizeOf)
NS_MEMORY_REPORTER_IMPLEMENT(CategoryManager,
"explicit/xpcom/category-manager",

View File

@ -232,8 +232,7 @@ CloneAndAppend(nsIFile* aBase, const nsACString& append)
// nsComponentManagerImpl
////////////////////////////////////////////////////////////////////////////////
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ComponentManagerMallocSizeOf,
"component-manager")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ComponentManagerMallocSizeOf)
static int64_t
GetComponentManagerSize()

View File

@ -26,7 +26,7 @@ static int gCallCount = 0;
#endif
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(XPTMallocSizeOf, "xpti-working-set")
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(XPTMallocSizeOf)
size_t
xptiInterfaceInfoManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)