Bug 905465 - Minor memory reporter manager code style clean-ups. r=jlebar.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 14 Aug 2013 18:19:24 -0700
changeset 142701 c8db7f677007aa7f7686b46ee244dc8cb13f6e03
parent 142700 2525ab02e44516690d8a0c940d9daaa4cf97e56e
child 142702 66e1ed80ba0526e87ef15046421635228a0b23c3
push idunknown
push userunknown
push dateunknown
reviewersjlebar
bugs905465
milestone26.0a1
Bug 905465 - Minor memory reporter manager code style clean-ups. r=jlebar.
xpcom/base/nsIMemoryReporter.idl
xpcom/base/nsMemoryReporterManager.cpp
--- a/xpcom/base/nsIMemoryReporter.idl
+++ b/xpcom/base/nsIMemoryReporter.idl
@@ -345,33 +345,30 @@ interface nsIMemoryReporterManager : nsI
         NS_FALLIBLE_MEMORY_REPORTER_IMPLEMENT_HELPER(_c, _p, _k, _u, _a, _d, _THREADSAFE_)
 
 #define NS_MEMORY_REPORTER_NAME(_classname)  MemoryReporter_##_classname
 
 // Note that the memory reporters are held in an nsCOMArray, which means
 // that individual reporters should be referenced with |nsIMemoryReporter *|
 // instead of nsCOMPtr<nsIMemoryReporter>.
 
-XPCOM_API(nsresult) NS_RegisterMemoryReporter(nsIMemoryReporter *reporter);
-XPCOM_API(nsresult) NS_RegisterMemoryMultiReporter(nsIMemoryMultiReporter *reporter);
+XPCOM_API(nsresult) NS_RegisterMemoryReporter(nsIMemoryReporter* aReporter);
+XPCOM_API(nsresult) NS_RegisterMemoryMultiReporter(nsIMemoryMultiReporter* aReporter);
 
-XPCOM_API(nsresult) NS_UnregisterMemoryReporter(nsIMemoryReporter *reporter);
-XPCOM_API(nsresult) NS_UnregisterMemoryMultiReporter(nsIMemoryMultiReporter *reporter);
+XPCOM_API(nsresult) NS_UnregisterMemoryReporter(nsIMemoryReporter* aReporter);
+XPCOM_API(nsresult) NS_UnregisterMemoryMultiReporter(nsIMemoryMultiReporter* aReporter);
 
 #if defined(MOZ_DMD)
 namespace mozilla {
 namespace dmd {
 // This runs all the memory reporters but does nothing with the results;  i.e.
 // it does the minimal amount of work possible for DMD to do its thing.
 void RunReporters();
 }
 }
-#endif  // defined(MOZ_DMD)
-
-#if defined(MOZ_DMD)
 
 #if !defined(MOZ_MEMORY)
 #error "MOZ_DMD requires MOZ_MEMORY"
 #endif
 
 #include "DMD.h"
 
 #define MOZ_REPORT(ptr)          mozilla::dmd::Report(ptr)
@@ -391,37 +388,37 @@ void RunReporters();
 // 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)                              \
-  static size_t fn(const void *ptr)                                           \
+  static size_t fn(const void* aPtr)                                          \
   {                                                                           \
-      MOZ_REPORT(ptr);                                                        \
-      return moz_malloc_size_of(ptr);                                         \
+      MOZ_REPORT(aPtr);                                                       \
+      return moz_malloc_size_of(aPtr);                                        \
   }
 
 // Functions generated by the next two macros should be used by wrapping
 // allocators that report heap blocks as soon as they are allocated and
 // 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)                     \
-  static size_t fn(const void *ptr)                                           \
+  static size_t fn(const void* aPtr)                                          \
   {                                                                           \
-      MOZ_REPORT_ON_ALLOC(ptr);                                               \
-      return moz_malloc_size_of(ptr);                                         \
+      MOZ_REPORT_ON_ALLOC(aPtr);                                              \
+      return moz_malloc_size_of(aPtr);                                        \
   }
 #define NS_MEMORY_REPORTER_MALLOC_SIZEOF_ON_FREE_FUN(fn)                      \
-  static size_t fn(const void *ptr)                                           \
+  static size_t fn(const void* aPtr)                                          \
   {                                                                           \
-      return moz_malloc_size_of(ptr);                                         \
+      return moz_malloc_size_of(aPtr);                                        \
   }
 
 namespace mozilla {
 
 // The following base class reduces the amount of boilerplate code required for
 // memory reporters.  You just need to provide the following.
 // - The constant values: path, kind, units, and description.  They are passed
 //   to the MemoryReporterBase constructor.
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -33,49 +33,49 @@ using namespace mozilla;
 #if defined(MOZ_MEMORY)
 #  define HAVE_JEMALLOC_STATS 1
 #  include "mozmemory.h"
 #endif  // MOZ_MEMORY
 
 #if defined(XP_LINUX)
 
 #include <unistd.h>
-static nsresult GetProcSelfStatmField(int field, int64_t *n)
+static nsresult GetProcSelfStatmField(int aField, int64_t* aN)
 {
     // There are more than two fields, but we're only interested in the first
     // two.
     static const int MAX_FIELD = 2;
     size_t fields[MAX_FIELD];
-    MOZ_ASSERT(field < MAX_FIELD, "bad field number");
-    FILE *f = fopen("/proc/self/statm", "r");
+    MOZ_ASSERT(aField < MAX_FIELD, "bad field number");
+    FILE* f = fopen("/proc/self/statm", "r");
     if (f) {
         int nread = fscanf(f, "%zu %zu", &fields[0], &fields[1]);
         fclose(f);
         if (nread == MAX_FIELD) {
-            *n = fields[field] * getpagesize();
+            *aN = fields[aField] * getpagesize();
             return NS_OK;
         }
     }
     return NS_ERROR_FAILURE;
 }
 
 #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-static nsresult GetVsize(int64_t *n)
+static nsresult GetVsize(int64_t* aN)
 {
-    return GetProcSelfStatmField(0, n);
+    return GetProcSelfStatmField(0, aN);
 }
 
-static nsresult GetResident(int64_t *n)
+static nsresult GetResident(int64_t* aN)
 {
-    return GetProcSelfStatmField(1, n);
+    return GetProcSelfStatmField(1, aN);
 }
 
-static nsresult GetResidentFast(int64_t *n)
+static nsresult GetResidentFast(int64_t* aN)
 {
-    return GetResident(n);
+    return GetResident(aN);
 }
 
 #elif defined(__DragonFly__) || defined(__FreeBSD__) \
     || defined(__NetBSD__) || defined(__OpenBSD__)
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #if defined(__DragonFly__) || defined(__FreeBSD__)
@@ -102,75 +102,75 @@ static nsresult GetResidentFast(int64_t 
 #define KP_SIZE(kp) (kp.p_vm_msize * getpagesize())
 #define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
 #elif defined(__OpenBSD__)
 #define KP_SIZE(kp) ((kp.p_vm_dsize + kp.p_vm_ssize                     \
                       + kp.p_vm_tsize) * getpagesize())
 #define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
 #endif
 
-static nsresult GetKinfoProcSelf(KINFO_PROC *proc)
+static nsresult GetKinfoProcSelf(KINFO_PROC* aProc)
 {
     int mib[] = {
         CTL_KERN,
         KERN_PROC,
         KERN_PROC_PID,
         getpid(),
 #if defined(__NetBSD__) || defined(__OpenBSD__)
         sizeof(KINFO_PROC),
         1,
 #endif
     };
     u_int miblen = sizeof(mib) / sizeof(mib[0]);
     size_t size = sizeof(KINFO_PROC);
-    if (sysctl(mib, miblen, proc, &size, NULL, 0))
+    if (sysctl(mib, miblen, aProc, &size, NULL, 0))
         return NS_ERROR_FAILURE;
 
     return NS_OK;
 }
 
 #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-static nsresult GetVsize(int64_t *n)
+static nsresult GetVsize(int64_t* aN)
 {
     KINFO_PROC proc;
     nsresult rv = GetKinfoProcSelf(&proc);
     if (NS_SUCCEEDED(rv))
-        *n = KP_SIZE(proc);
+        *aN = KP_SIZE(proc);
 
     return rv;
 }
 
-static nsresult GetResident(int64_t *n)
+static nsresult GetResident(int64_t* aN)
 {
     KINFO_PROC proc;
     nsresult rv = GetKinfoProcSelf(&proc);
     if (NS_SUCCEEDED(rv))
-        *n = KP_RSS(proc);
+        *aN = KP_RSS(proc);
 
     return rv;
 }
 
-static nsresult GetResidentFast(int64_t *n)
+static nsresult GetResidentFast(int64_t* aN)
 {
-    return GetResident(n);
+    return GetResident(aN);
 }
 
 #elif defined(SOLARIS)
 
 #include <procfs.h>
 #include <fcntl.h>
 #include <unistd.h>
 
 static void XMappingIter(int64_t& vsize, int64_t& resident)
 {
     vsize = -1;
     resident = -1;
     int mapfd = open("/proc/self/xmap", O_RDONLY);
     struct stat st;
-    prxmap_t *prmapp = NULL;
+    prxmap_t* prmapp = NULL;
     if (mapfd >= 0) {
         if (!fstat(mapfd, &st)) {
             int nmap = st.st_size / sizeof(prxmap_t);
             while (1) {
                 // stat(2) on /proc/<pid>/xmap returns an incorrect value,
                 // prior to the release of Solaris 11.
                 // Here is a workaround for it.
                 nmap *= 2;
@@ -196,153 +196,153 @@ static void XMappingIter(int64_t& vsize,
             }
             free(prmapp);
         }
         close(mapfd);
     }
 }
 
 #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-static nsresult GetVsize(int64_t *n)
+static nsresult GetVsize(int64_t* aN)
 {
     int64_t vsize, resident;
     XMappingIter(vsize, resident);
     if (vsize == -1) {
         return NS_ERROR_FAILURE;
     }
-    *n = vsize;
+    *aN = vsize;
     return NS_OK;
 }
 
-static nsresult GetResident(int64_t *n)
+static nsresult GetResident(int64_t* aN)
 {
     int64_t vsize, resident;
     XMappingIter(vsize, resident);
     if (resident == -1) {
         return NS_ERROR_FAILURE;
     }
-    *n = resident;
+    *aN = resident;
     return NS_OK;
 }
 
-static nsresult GetResidentFast(int64_t *n)
+static nsresult GetResidentFast(int64_t* aN)
 {
-    return GetResident(n);
+    return GetResident(aN);
 }
 
 #elif defined(XP_MACOSX)
 
 #include <mach/mach_init.h>
 #include <mach/task.h>
 
-static bool GetTaskBasicInfo(struct task_basic_info *ti)
+static bool GetTaskBasicInfo(struct task_basic_info* aTi)
 {
     mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
     kern_return_t kr = task_info(mach_task_self(), TASK_BASIC_INFO,
-                                 (task_info_t)ti, &count);
+                                 (task_info_t)aTi, &count);
     return kr == KERN_SUCCESS;
 }
 
 // The VSIZE figure on Mac includes huge amounts of shared memory and is always
 // absurdly high, eg. 2GB+ even at start-up.  But both 'top' and 'ps' report
 // it, so we might as well too.
 #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-static nsresult GetVsize(int64_t *n)
+static nsresult GetVsize(int64_t* aN)
 {
     task_basic_info ti;
     if (!GetTaskBasicInfo(&ti))
         return NS_ERROR_FAILURE;
 
-    *n = ti.virtual_size;
+    *aN = ti.virtual_size;
     return NS_OK;
 }
 
 // If we're using jemalloc on Mac, we need to instruct jemalloc to purge the
 // pages it has madvise(MADV_FREE)'d before we read our RSS in order to get
 // an accurate result.  The OS will take away MADV_FREE'd pages when there's
 // memory pressure, so ideally, they shouldn't count against our RSS.
 //
 // Purging these pages can take a long time for some users (see bug 789975),
 // so we provide the option to get the RSS without purging first.
-static nsresult GetResident(int64_t *n, bool aDoPurge)
+static nsresult GetResident(int64_t* aN, bool aDoPurge)
 {
 #ifdef HAVE_JEMALLOC_STATS
     if (aDoPurge) {
       Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer;
       jemalloc_purge_freed_pages();
     }
 #endif
 
     task_basic_info ti;
     if (!GetTaskBasicInfo(&ti))
         return NS_ERROR_FAILURE;
 
-    *n = ti.resident_size;
+    *aN = ti.resident_size;
     return NS_OK;
 }
 
-static nsresult GetResidentFast(int64_t *n)
+static nsresult GetResidentFast(int64_t* aN)
 {
-    return GetResident(n, /* doPurge = */ false);
+    return GetResident(aN, /* doPurge = */ false);
 }
 
-static nsresult GetResident(int64_t *n)
+static nsresult GetResident(int64_t* aN)
 {
-    return GetResident(n, /* doPurge = */ true);
+    return GetResident(aN, /* doPurge = */ true);
 }
 
 #elif defined(XP_WIN)
 
 #include <windows.h>
 #include <psapi.h>
 
 #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-static nsresult GetVsize(int64_t *n)
+static nsresult GetVsize(int64_t* aN)
 {
     MEMORYSTATUSEX s;
     s.dwLength = sizeof(s);
 
     if (!GlobalMemoryStatusEx(&s)) {
         return NS_ERROR_FAILURE;
     }
 
-    *n = s.ullTotalVirtual - s.ullAvailVirtual;
+    *aN = s.ullTotalVirtual - s.ullAvailVirtual;
     return NS_OK;
 }
 
-static nsresult GetResident(int64_t *n)
+static nsresult GetResident(int64_t* aN)
 {
     PROCESS_MEMORY_COUNTERS pmc;
     pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS);
 
     if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
         return NS_ERROR_FAILURE;
     }
 
-    *n = pmc.WorkingSetSize;
+    *aN = pmc.WorkingSetSize;
     return NS_OK;
 }
 
-static nsresult GetResidentFast(int64_t *n)
+static nsresult GetResidentFast(int64_t* aN)
 {
-    return GetResident(n);
+    return GetResident(aN);
 }
 
 #define HAVE_PRIVATE_REPORTER
 class PrivateReporter MOZ_FINAL : public MemoryReporterBase
 {
 public:
     PrivateReporter()
       : MemoryReporterBase("private", KIND_OTHER, UNITS_BYTES,
 "Memory that cannot be shared with other processes, including memory that is "
 "committed and marked MEM_PRIVATE, data that is not mapped, and executable "
 "pages that have been written to.")
     {}
 
-    NS_IMETHOD GetAmount(int64_t *aAmount)
+    NS_IMETHOD GetAmount(int64_t* aAmount)
     {
         PROCESS_MEMORY_COUNTERS_EX pmcex;
         pmcex.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
 
         if (!GetProcessMemoryInfo(
                 GetCurrentProcess(),
                 (PPROCESS_MEMORY_COUNTERS) &pmcex, sizeof(pmcex))) {
             return NS_ERROR_FAILURE;
@@ -365,48 +365,48 @@ public:
 "thread stacks, memory explicitly mapped by the process via mmap and similar "
 "operations, and memory shared with other processes. This is the vsize figure "
 "as reported by 'top' and 'ps'.  This figure is of limited use on Mac, where "
 "processes share huge amounts of memory with one another.  But even on other "
 "operating systems, 'resident' is a much better measure of the memory "
 "resources used by the process.")
     {}
 
-    NS_IMETHOD GetAmount(int64_t *aAmount) { return GetVsize(aAmount); }
+    NS_IMETHOD GetAmount(int64_t* aAmount) { return GetVsize(aAmount); }
 };
 
 class ResidentReporter MOZ_FINAL : public MemoryReporterBase
 {
 public:
     ResidentReporter()
       : MemoryReporterBase("resident", KIND_OTHER, UNITS_BYTES,
 "Memory mapped by the process that is present in physical memory, also known "
 "as the resident set size (RSS).  This is the best single figure to use when "
 "considering the memory resources used by the process, but it depends both on "
 "other processes being run and details of the OS kernel and so is best used "
 "for comparing the memory usage of a single process at different points in "
 "time.")
     {}
 
-    NS_IMETHOD GetAmount(int64_t *aAmount) { return GetResident(aAmount); }
+    NS_IMETHOD GetAmount(int64_t* aAmount) { return GetResident(aAmount); }
 };
 
 class ResidentFastReporter MOZ_FINAL : public MemoryReporterBase
 {
 public:
     ResidentFastReporter()
       : MemoryReporterBase("resident-fast", KIND_OTHER, UNITS_BYTES,
 "This is the same measurement as 'resident', but it tries to be as fast as "
 "possible at the expense of accuracy.  On most platforms this is identical to "
 "the 'resident' measurement, but on Mac it may over-count.  You should use "
 "'resident-fast' where you care about latency of collection (e.g. in "
 "telemetry).  Otherwise you should use 'resident'.")
     {}
 
-    NS_IMETHOD GetAmount(int64_t *aAmount) { return GetResidentFast(aAmount); }
+    NS_IMETHOD GetAmount(int64_t* aAmount) { return GetResidentFast(aAmount); }
 };
 #endif  // HAVE_VSIZE_AND_RESIDENT_REPORTERS
 
 #ifdef XP_UNIX
 
 #include <sys/time.h>
 #include <sys/resource.h>
 
@@ -424,17 +424,17 @@ public:
 "not mapped into the process's address space.  For instance, a process might "
 "observe soft page faults when it loads a shared library which is already "
 "present in physical memory. A process may experience many thousands of soft "
 "page faults even when the machine has plenty of available physical memory, "
 "and because the OS services a soft page fault without accessing the disk, "
 "they impact performance much less than hard page faults.")
     {}
 
-    NS_IMETHOD GetAmount(int64_t *aAmount)
+    NS_IMETHOD GetAmount(int64_t* aAmount)
     {
         struct rusage usage;
         int err = getrusage(RUSAGE_SELF, &usage);
         if (err != 0) {
             return NS_ERROR_FAILURE;
         }
         *aAmount = usage.ru_minflt;
         return NS_OK;
@@ -453,17 +453,17 @@ public:
 "operating system must access the disk in order to fulfill a hard page fault. "
 "When memory is plentiful, you should see very few hard page faults. But if "
 "the process tries to use more memory than your machine has available, you "
 "may see many thousands of hard page faults. Because accessing the disk is up "
 "to a million times slower than accessing RAM, the program may run very "
 "slowly when it is experiencing more than 100 or so hard page faults a second.")
     {}
 
-    NS_IMETHOD GetAmount(int64_t *aAmount)
+    NS_IMETHOD GetAmount(int64_t* aAmount)
     {
         struct rusage usage;
         int err = getrusage(RUSAGE_SELF, &usage);
         if (err != 0) {
             return NS_ERROR_FAILURE;
         }
         *aAmount = usage.ru_majflt;
         return NS_OK;
@@ -626,35 +626,35 @@ namespace dmd {
 class DMDMultiReporter MOZ_FINAL : public nsIMemoryMultiReporter
 {
 public:
   DMDMultiReporter()
   {}
 
   NS_DECL_ISUPPORTS
 
-  NS_IMETHOD GetName(nsACString &name)
+  NS_IMETHOD GetName(nsACString& aName)
   {
-    name.Assign("dmd");
+    aName.Assign("dmd");
     return NS_OK;
   }
 
-  NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *callback,
-                            nsISupports *closure)
+  NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback* aCallback,
+                            nsISupports* aClosure)
   {
     dmd::Sizes sizes;
     dmd::SizeOf(&sizes);
 
 #define REPORT(_path, _amount, _desc)                                         \
     do {                                                                      \
       nsresult rv;                                                            \
-      rv = callback->Callback(EmptyCString(), NS_LITERAL_CSTRING(_path),      \
-                              nsIMemoryReporter::KIND_HEAP,                   \
-                              nsIMemoryReporter::UNITS_BYTES, _amount,        \
-                              NS_LITERAL_CSTRING(_desc), closure);            \
+      rv = aCallback->Callback(EmptyCString(), NS_LITERAL_CSTRING(_path),     \
+                               nsIMemoryReporter::KIND_HEAP,                  \
+                               nsIMemoryReporter::UNITS_BYTES, _amount,       \
+                               NS_LITERAL_CSTRING(_desc), aClosure);          \
       NS_ENSURE_SUCCESS(rv, rv);                                              \
     } while (0)
 
     REPORT("explicit/dmd/stack-traces/used",
            sizes.mStackTracesUsed,
            "Memory used by stack traces which correspond to at least "
            "one heap block DMD is tracking.");
 
@@ -806,164 +806,164 @@ nsMemoryReporterManager::nsMemoryReporte
     mMultiReporters.Init();
 }
 
 nsMemoryReporterManager::~nsMemoryReporterManager()
 {
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::EnumerateReporters(nsISimpleEnumerator **result)
+nsMemoryReporterManager::EnumerateReporters(nsISimpleEnumerator** aResult)
 {
     // Memory reporters are not necessarily threadsafe, so EnumerateReporters()
     // must be called from the main thread.
     if (!NS_IsMainThread()) {
         MOZ_CRASH();
     }
 
     mozilla::MutexAutoLock autoLock(mMutex);
 
     nsRefPtr<HashtableEnumerator> enumerator =
         new HashtableEnumerator(mReporters);
-    enumerator.forget(result);
+    enumerator.forget(aResult);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::EnumerateMultiReporters(nsISimpleEnumerator **result)
+nsMemoryReporterManager::EnumerateMultiReporters(nsISimpleEnumerator** aResult)
 {
     // Memory multi-reporters are not necessarily threadsafe, so
     // EnumerateMultiReporters() must be called from the main thread.
     if (!NS_IsMainThread()) {
         MOZ_CRASH();
     }
 
     mozilla::MutexAutoLock autoLock(mMutex);
 
     nsRefPtr<HashtableEnumerator> enumerator =
         new HashtableEnumerator(mMultiReporters);
-    enumerator.forget(result);
+    enumerator.forget(aResult);
     return NS_OK;
 }
 
 static void
 DebugAssertRefcountIsNonZero(nsISupports* aObj)
 {
 #ifdef DEBUG
     // This will probably crash if the object's refcount is 0.
     uint32_t refcnt = NS_ADDREF(aObj);
     MOZ_ASSERT(refcnt >= 2);
     NS_RELEASE(aObj);
 #endif
 }
 
 nsresult
 nsMemoryReporterManager::RegisterReporterHelper(
-    nsIMemoryReporter *reporter, bool aForce)
+    nsIMemoryReporter* aReporter, bool aForce)
 {
     // This method is thread-safe.
     mozilla::MutexAutoLock autoLock(mMutex);
 
-    if ((mIsRegistrationBlocked && !aForce) || mReporters.Contains(reporter)) {
+    if ((mIsRegistrationBlocked && !aForce) || mReporters.Contains(aReporter)) {
         return NS_ERROR_FAILURE;
     }
 
-    // This method needs to be safe even if |reporter| has a refcnt of 0, so we
-    // take a kung fu death grip before calling PutEntry.  Otherwise, if
-    // PutEntry addref'ed and released reporter before finally addref'ing it for
-    // good, it would free reporter!
+    // This method needs to be safe even if |aReporter| has a refcnt of 0, so
+    // we take a kung fu death grip before calling PutEntry.  Otherwise, if
+    // PutEntry addref'ed and released |aReporter| before finally addref'ing it
+    // for good, it would free aReporter!
     //
     // The kung fu death grip could itself be problematic if PutEntry didn't
-    // addref |reporter| (because then when the death grip goes out of scope, we
-    // would delete the reporter).  In debug mode, we check that this doesn't
-    // happen.
+    // addref |aReporter| (because then when the death grip goes out of scope,
+    // we would delete the reporter).  In debug mode, we check that this
+    // doesn't happen.
 
     {
-        nsCOMPtr<nsIMemoryReporter> kungFuDeathGrip = reporter;
-        mReporters.PutEntry(reporter);
+        nsCOMPtr<nsIMemoryReporter> kungFuDeathGrip = aReporter;
+        mReporters.PutEntry(aReporter);
     }
 
-    DebugAssertRefcountIsNonZero(reporter);
+    DebugAssertRefcountIsNonZero(aReporter);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::RegisterReporter(nsIMemoryReporter *reporter)
+nsMemoryReporterManager::RegisterReporter(nsIMemoryReporter* aReporter)
 {
-    return RegisterReporterHelper(reporter, /* force = */ false);
+    return RegisterReporterHelper(aReporter, /* force = */ false);
 }
 
 NS_IMETHODIMP
 nsMemoryReporterManager::RegisterReporterEvenIfBlocked(
-    nsIMemoryReporter *reporter)
+    nsIMemoryReporter* aReporter)
 {
-    return RegisterReporterHelper(reporter, /* force = */ true);
+    return RegisterReporterHelper(aReporter, /* force = */ true);
 }
 
 nsresult
 nsMemoryReporterManager::RegisterMultiReporterHelper(
-    nsIMemoryMultiReporter *reporter, bool aForce)
+    nsIMemoryMultiReporter* aReporter, bool aForce)
 {
     // This method is thread-safe.
     mozilla::MutexAutoLock autoLock(mMutex);
 
     if ((mIsRegistrationBlocked && !aForce) ||
-         mMultiReporters.Contains(reporter)) {
+         mMultiReporters.Contains(aReporter)) {
         return NS_ERROR_FAILURE;
     }
 
     {
-        nsCOMPtr<nsIMemoryMultiReporter> kungFuDeathGrip = reporter;
-        mMultiReporters.PutEntry(reporter);
+        nsCOMPtr<nsIMemoryMultiReporter> kungFuDeathGrip = aReporter;
+        mMultiReporters.PutEntry(aReporter);
     }
 
-    DebugAssertRefcountIsNonZero(reporter);
+    DebugAssertRefcountIsNonZero(aReporter);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::RegisterMultiReporter(nsIMemoryMultiReporter *reporter)
+nsMemoryReporterManager::RegisterMultiReporter(nsIMemoryMultiReporter* aReporter)
 {
-    return RegisterMultiReporterHelper(reporter, /* force = */ false);
+    return RegisterMultiReporterHelper(aReporter, /* force = */ false);
 }
 
 NS_IMETHODIMP
 nsMemoryReporterManager::RegisterMultiReporterEvenIfBlocked(
-    nsIMemoryMultiReporter *reporter)
+    nsIMemoryMultiReporter* aReporter)
 {
-    return RegisterMultiReporterHelper(reporter, /* force = */ true);
+    return RegisterMultiReporterHelper(aReporter, /* force = */ true);
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::UnregisterReporter(nsIMemoryReporter *reporter)
+nsMemoryReporterManager::UnregisterReporter(nsIMemoryReporter* aReporter)
 {
     // This method is thread-safe.
     mozilla::MutexAutoLock autoLock(mMutex);
 
-    if (!mReporters.Contains(reporter)) {
+    if (!mReporters.Contains(aReporter)) {
         return NS_ERROR_FAILURE;
     }
 
-    mReporters.RemoveEntry(reporter);
+    mReporters.RemoveEntry(aReporter);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::UnregisterMultiReporter(nsIMemoryMultiReporter *reporter)
+nsMemoryReporterManager::UnregisterMultiReporter(nsIMemoryMultiReporter* aReporter)
 {
     // This method is thread-safe.
     mozilla::MutexAutoLock autoLock(mMutex);
 
-    if (!mMultiReporters.Contains(reporter)) {
+    if (!mMultiReporters.Contains(aReporter)) {
         return NS_ERROR_FAILURE;
     }
 
-    mMultiReporters.RemoveEntry(reporter);
+    mMultiReporters.RemoveEntry(aReporter);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMemoryReporterManager::BlockRegistration()
 {
     // This method is thread-safe.
     mozilla::MutexAutoLock autoLock(mMutex);
@@ -982,17 +982,17 @@ nsMemoryReporterManager::UnblockRegistra
     if (!mIsRegistrationBlocked) {
         return NS_ERROR_FAILURE;
     }
     mIsRegistrationBlocked = false;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::GetResident(int64_t *aResident)
+nsMemoryReporterManager::GetResident(int64_t* aResident)
 {
 #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
     return ::GetResident(aResident);
 #else
     *aResident = 0;
     return NS_ERROR_NOT_AVAILABLE;
 #endif
 }
@@ -1007,39 +1007,39 @@ public:
 };
 NS_IMPL_ISUPPORTS0(Int64Wrapper)
 
 class ExplicitNonHeapCountingCallback MOZ_FINAL : public nsIMemoryMultiReporterCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
-    NS_IMETHOD Callback(const nsACString &aProcess, const nsACString &aPath,
+    NS_IMETHOD Callback(const nsACString& aProcess, const nsACString& aPath,
                         int32_t aKind, int32_t aUnits, int64_t aAmount,
-                        const nsACString &aDescription,
-                        nsISupports *aWrappedExplicitNonHeap)
+                        const nsACString& aDescription,
+                        nsISupports* aWrappedExplicitNonHeap)
     {
         if (aKind == nsIMemoryReporter::KIND_NONHEAP &&
             PromiseFlatCString(aPath).Find("explicit") == 0 &&
             aAmount != int64_t(-1))
         {
-            Int64Wrapper *wrappedPRInt64 =
-                static_cast<Int64Wrapper *>(aWrappedExplicitNonHeap);
+            Int64Wrapper* wrappedPRInt64 =
+                static_cast<Int64Wrapper*>(aWrappedExplicitNonHeap);
             wrappedPRInt64->mValue += aAmount;
         }
         return NS_OK;
     }
 };
 NS_IMPL_ISUPPORTS1(
   ExplicitNonHeapCountingCallback
 , nsIMemoryMultiReporterCallback
 )
 
 NS_IMETHODIMP
-nsMemoryReporterManager::GetExplicit(int64_t *aExplicit)
+nsMemoryReporterManager::GetExplicit(int64_t* aExplicit)
 {
     NS_ENSURE_ARG_POINTER(aExplicit);
     *aExplicit = 0;
 #ifndef HAVE_JEMALLOC_STATS
     return NS_ERROR_NOT_AVAILABLE;
 #else
     nsresult rv;
     bool more;
@@ -1101,19 +1101,19 @@ nsMemoryReporterManager::GetExplicit(int
     int64_t explicitNonHeapMultiSize = wrappedExplicitNonHeapMultiSize->mValue;
 
     *aExplicit = heapAllocated + explicitNonHeapNormalSize + explicitNonHeapMultiSize;
     return NS_OK;
 #endif // HAVE_JEMALLOC_STATS
 }
 
 NS_IMETHODIMP
-nsMemoryReporterManager::GetHasMozMallocUsableSize(bool *aHas)
+nsMemoryReporterManager::GetHasMozMallocUsableSize(bool* aHas)
 {
-    void *p = malloc(16);
+    void* p = malloc(16);
     if (!p) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
     size_t usable = moz_malloc_usable_size(p);
     free(p);
     *aHas = !!(usable > 0);
     return NS_OK;
 }
@@ -1186,82 +1186,86 @@ private:
   uint32_t mRemainingIters;
   bool mCanceled;
 };
 
 } // anonymous namespace
 
 NS_IMETHODIMP
 nsMemoryReporterManager::MinimizeMemoryUsage(nsIRunnable* aCallback,
-                                             nsICancelableRunnable **result)
+                                             nsICancelableRunnable** aResult)
 {
-  NS_ENSURE_ARG_POINTER(result);
+  NS_ENSURE_ARG_POINTER(aResult);
 
   nsRefPtr<nsICancelableRunnable> runnable =
     new MinimizeMemoryUsageRunnable(aCallback);
-  NS_ADDREF(*result = runnable);
+  NS_ADDREF(*aResult = runnable);
 
   return NS_DispatchToMainThread(runnable);
 }
 
 // Most memory reporters don't need thread safety, but some do.  Make them all
 // thread-safe just to be safe.  Memory reporters are created and destroyed
 // infrequently enough that the performance cost should be negligible.
 NS_IMPL_ISUPPORTS1(MemoryReporterBase, nsIMemoryReporter)
 
 nsresult
-NS_RegisterMemoryReporter (nsIMemoryReporter *reporter)
+NS_RegisterMemoryReporter(nsIMemoryReporter* aReporter)
 {
     nsCOMPtr<nsIMemoryReporterManager> mgr = do_GetService("@mozilla.org/memory-reporter-manager;1");
-    if (mgr == nullptr)
+    if (!mgr) {
         return NS_ERROR_FAILURE;
-    return mgr->RegisterReporter(reporter);
+    }
+    return mgr->RegisterReporter(aReporter);
 }
 
 nsresult
-NS_RegisterMemoryMultiReporter (nsIMemoryMultiReporter *reporter)
+NS_RegisterMemoryMultiReporter(nsIMemoryMultiReporter* aReporter)
 {
     nsCOMPtr<nsIMemoryReporterManager> mgr = do_GetService("@mozilla.org/memory-reporter-manager;1");
-    if (mgr == nullptr)
+    if (!mgr) {
         return NS_ERROR_FAILURE;
-    return mgr->RegisterMultiReporter(reporter);
+    }
+    return mgr->RegisterMultiReporter(aReporter);
 }
 
 nsresult
-NS_UnregisterMemoryReporter (nsIMemoryReporter *reporter)
+NS_UnregisterMemoryReporter(nsIMemoryReporter* aReporter)
 {
     nsCOMPtr<nsIMemoryReporterManager> mgr = do_GetService("@mozilla.org/memory-reporter-manager;1");
-    if (mgr == nullptr)
+    if (!mgr) {
         return NS_ERROR_FAILURE;
-    return mgr->UnregisterReporter(reporter);
+    }
+    return mgr->UnregisterReporter(aReporter);
 }
 
 nsresult
-NS_UnregisterMemoryMultiReporter (nsIMemoryMultiReporter *reporter)
+NS_UnregisterMemoryMultiReporter(nsIMemoryMultiReporter* aReporter)
 {
     nsCOMPtr<nsIMemoryReporterManager> mgr = do_GetService("@mozilla.org/memory-reporter-manager;1");
-    if (mgr == nullptr)
+    if (!mgr) {
         return NS_ERROR_FAILURE;
-    return mgr->UnregisterMultiReporter(reporter);
+    }
+    return mgr->UnregisterMultiReporter(aReporter);
 }
 
 #if defined(MOZ_DMD)
 
 namespace mozilla {
 namespace dmd {
 
 class NullMultiReporterCallback : public nsIMemoryMultiReporterCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
-    NS_IMETHOD Callback(const nsACString &aProcess, const nsACString &aPath,
+    NS_IMETHOD Callback(const nsACString& aProcess, const nsACString& aPath,
                         int32_t aKind, int32_t aUnits, int64_t aAmount,
-                        const nsACString &aDescription,
-                        nsISupports *aData)
+                        const nsACString& aDescription,
+                        nsISupports* aData)
     {
         // Do nothing;  the reporter has already reported to DMD.
         return NS_OK;
     }
 };
 NS_IMPL_ISUPPORTS1(
   NullMultiReporterCallback
 , nsIMemoryMultiReporterCallback