Bug 687724 (part 4) - Re-indent JSMemoryMultiReporter's methods. r=bholley.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 05 Jul 2012 21:16:11 -0700
changeset 98492 0158f2d0b32d
parent 98491 e586043f5b58
child 98493 778e030fa299
push id11506
push usernnethercote@mozilla.com
push dateFri, 06 Jul 2012 05:52:14 +0000
treeherdermozilla-inbound@0158f2d0b32d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs687724
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 687724 (part 4) - Re-indent JSMemoryMultiReporter's methods. r=bholley.
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -1722,132 +1722,132 @@ class XPCJSRuntimeStats : public JS::Run
             cPathPrefix.AssignLiteral("explicit/js-non-window/compartments/no-global/");
         }
 
         cstats->extra1 = strdup(cPathPrefix.get());
         cstats->extra2 = strdup(cName.get());
     }
 };
     
-    nsresult
-    JSMemoryMultiReporter::CollectReports(WindowPaths *windowPaths,
-                                          nsIMemoryMultiReporterCallback *cb,
-                                          nsISupports *closure)
-    {
-        XPCJSRuntime *xpcrt = nsXPConnect::GetRuntimeInstance();
+nsresult
+JSMemoryMultiReporter::CollectReports(WindowPaths *windowPaths,
+                                      nsIMemoryMultiReporterCallback *cb,
+                                      nsISupports *closure)
+{
+    XPCJSRuntime *xpcrt = nsXPConnect::GetRuntimeInstance();
 
-        // In the first step we get all the stats and stash them in a local
-        // data structure.  In the second step we pass all the stashed stats to
-        // the callback.  Separating these steps is important because the
-        // callback may be a JS function, and executing JS while getting these
-        // stats seems like a bad idea.
+    // In the first step we get all the stats and stash them in a local
+    // data structure.  In the second step we pass all the stashed stats to
+    // the callback.  Separating these steps is important because the
+    // callback may be a JS function, and executing JS while getting these
+    // stats seems like a bad idea.
 
-        XPCJSRuntimeStats rtStats(windowPaths);
-        if (!rtStats.init(xpcrt))
-            return NS_ERROR_FAILURE;
+    XPCJSRuntimeStats rtStats(windowPaths);
+    if (!rtStats.init(xpcrt))
+        return NS_ERROR_FAILURE;
 
-        if (!JS::CollectRuntimeStats(xpcrt->GetJSRuntime(), &rtStats))
-            return NS_ERROR_FAILURE;
+    if (!JS::CollectRuntimeStats(xpcrt->GetJSRuntime(), &rtStats))
+        return NS_ERROR_FAILURE;
 
-        size_t xpconnect =
-            xpcrt->SizeOfIncludingThis(JsMallocSizeOf) +
-            XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(JsMallocSizeOf);
+    size_t xpconnect =
+        xpcrt->SizeOfIncludingThis(JsMallocSizeOf) +
+        XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(JsMallocSizeOf);
 
-        // This is the second step (see above).  First we report stuff in the
-        // "explicit" tree, then we report other stuff.
+    // This is the second step (see above).  First we report stuff in the
+    // "explicit" tree, then we report other stuff.
 
-        nsresult rv;
-        size_t rtTotal = 0;
-        rv = xpc::ReportJSRuntimeExplicitTreeStats(rtStats,
-                                                   NS_LITERAL_CSTRING("explicit/js-non-window/"),
-                                                   cb, closure, &rtTotal);
-        NS_ENSURE_SUCCESS(rv, rv);
+    nsresult rv;
+    size_t rtTotal = 0;
+    rv = xpc::ReportJSRuntimeExplicitTreeStats(rtStats,
+                                               NS_LITERAL_CSTRING("explicit/js-non-window/"),
+                                               cb, closure, &rtTotal);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-        // Report the sums of the compartment numbers.
-        rv = ReportCompartmentStats(rtStats.totals,
-                                    NS_LITERAL_CSTRING("js-main-runtime/compartments/"),
-                                    cb, closure);
-        NS_ENSURE_SUCCESS(rv, rv);
+    // Report the sums of the compartment numbers.
+    rv = ReportCompartmentStats(rtStats.totals,
+                                NS_LITERAL_CSTRING("js-main-runtime/compartments/"),
+                                cb, closure);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-        // Report the sum of the runtime/ numbers.
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/runtime"),
-                     nsIMemoryReporter::KIND_OTHER, rtTotal,
-                     "The sum of all measurements under 'explicit/js-non-window/runtime/'.");
+    // Report the sum of the runtime/ numbers.
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/runtime"),
+                 nsIMemoryReporter::KIND_OTHER, rtTotal,
+                 "The sum of all measurements under 'explicit/js-non-window/runtime/'.");
 
-        // Report the numbers for memory outside of compartments.
+    // Report the numbers for memory outside of compartments.
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/decommitted-arenas"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapDecommittedArenas,
-                     "The same as 'explicit/js-non-window/gc-heap/decommitted-arenas'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/decommitted-arenas"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapDecommittedArenas,
+                 "The same as 'explicit/js-non-window/gc-heap/decommitted-arenas'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/unused-chunks"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapUnusedChunks,
-                     "The same as 'explicit/js-non-window/gc-heap/unused-chunks'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/unused-chunks"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapUnusedChunks,
+                 "The same as 'explicit/js-non-window/gc-heap/unused-chunks'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/unused-arenas"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapUnusedArenas,
-                     "The same as 'explicit/js-non-window/gc-heap/unused-arenas'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/unused-arenas"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapUnusedArenas,
+                 "The same as 'explicit/js-non-window/gc-heap/unused-arenas'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/chunk-admin"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapChunkAdmin,
-                     "The same as 'explicit/js-non-window/gc-heap/chunk-admin'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime/gc-heap/chunk-admin"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapChunkAdmin,
+                 "The same as 'explicit/js-non-window/gc-heap/chunk-admin'.");
 
-        // Report a breakdown of the committed GC space.
+    // Report a breakdown of the committed GC space.
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/chunks"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapUnusedChunks,
-                     "The same as 'explicit/js-non-window/gc-heap/unused-chunks'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/chunks"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapUnusedChunks,
+                 "The same as 'explicit/js-non-window/gc-heap/unused-chunks'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/arenas"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapUnusedArenas,
-                     "The same as 'explicit/js-non-window/gc-heap/unused-arenas'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/arenas"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapUnusedArenas,
+                 "The same as 'explicit/js-non-window/gc-heap/unused-arenas'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/gc-things"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.totals.gcHeapUnusedGcThings,
-                     "The same as 'js-main-runtime/compartments/gc-heap/unused-gc-things'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/unused/gc-things"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.totals.gcHeapUnusedGcThings,
+                 "The same as 'js-main-runtime/compartments/gc-heap/unused-gc-things'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/chunk-admin"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapChunkAdmin,
-                     "The same as 'explicit/js-non-window/gc-heap/chunk-admin'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/chunk-admin"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapChunkAdmin,
+                 "The same as 'explicit/js-non-window/gc-heap/chunk-admin'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/arena-admin"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.totals.gcHeapArenaAdmin,
-                     "The same as 'js-main-runtime/compartments/gc-heap/arena-admin'.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/arena-admin"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.totals.gcHeapArenaAdmin,
+                 "The same as 'js-main-runtime/compartments/gc-heap/arena-admin'.");
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/gc-things"),
-                     nsIMemoryReporter::KIND_OTHER,
-                     rtStats.gcHeapGcThings,
-                     "Memory on the garbage-collected JavaScript heap that holds GC things such "
-                     "as objects, strings, scripts, etc.")
+    REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed/used/gc-things"),
+                 nsIMemoryReporter::KIND_OTHER,
+                 rtStats.gcHeapGcThings,
+                 "Memory on the garbage-collected JavaScript heap that holds GC things such "
+                 "as objects, strings, scripts, etc.")
 
-        // Report xpconnect.
+    // Report xpconnect.
 
-        REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect"),
-                     nsIMemoryReporter::KIND_HEAP, xpconnect,
-                     "Memory used by XPConnect.");
+    REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect"),
+                 nsIMemoryReporter::KIND_HEAP, xpconnect,
+                 "Memory used by XPConnect.");
 
-        return NS_OK;
-    }
+    return NS_OK;
+}
 
-    nsresult
-    JSMemoryMultiReporter::GetExplicitNonHeap(PRInt64 *n)
-    {
-        JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime();
-        *reinterpret_cast<int64_t*>(n) = JS::GetExplicitNonHeapForRuntime(rt, JsMallocSizeOf);
-        return NS_OK;
-    }
+nsresult
+JSMemoryMultiReporter::GetExplicitNonHeap(PRInt64 *n)
+{
+    JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime();
+    *reinterpret_cast<int64_t*>(n) = JS::GetExplicitNonHeapForRuntime(rt, JsMallocSizeOf);
+    return NS_OK;
+}
 
 } // namespace xpc
 
 #ifdef MOZ_CRASHREPORTER
 static JSBool
 DiagnosticMemoryCallback(void *ptr, size_t size)
 {
     return CrashReporter::RegisterAppMemory(ptr, size) == NS_OK;