Bug 943660 (attempt 2) - Remove nsIMemoryReporter::name, because it's (a) unused and (b) a bad idea. r=mccr8.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 26 Nov 2013 18:38:50 -0800
changeset 157903 73fdb97e906b098481725b3192b4c40b68607dda
parent 157902 e668d88804d15156ee133f019609a3709b007b1e
child 157904 72a3b33fcf83642ce9308cd725d56a0ad07e03ce
push id25726
push usercbook@mozilla.com
push dateThu, 28 Nov 2013 10:47:25 +0000
treeherdermozilla-central@cdca43b7657d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs943660
milestone28.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 943660 (attempt 2) - Remove nsIMemoryReporter::name, because it's (a) unused and (b) a bad idea. r=mccr8.
dom/base/nsWindowMemoryReporter.cpp
toolkit/components/aboutmemory/tests/test_aboutmemory.xul
toolkit/components/aboutmemory/tests/test_aboutmemory2.xul
toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
toolkit/components/aboutmemory/tests/test_memoryReporters.xul
xpcom/base/nsIMemoryReporter.idl
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -444,23 +444,16 @@ ReportGhostWindowsEnumerator(nsUint64Has
   if (NS_FAILED(rv) && NS_SUCCEEDED(data->rv)) {
     data->rv = rv;
   }
 
   return PL_DHASH_NEXT;
 }
 
 NS_IMETHODIMP
-nsWindowMemoryReporter::GetName(nsACString &aName)
-{
-  aName.AssignLiteral("window-objects");
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
                                        nsISupports* aClosure)
 {
   nsGlobalWindow::WindowByIdTable* windowsById =
     nsGlobalWindow::GetWindowsTable();
   NS_ENSURE_TRUE(windowsById, NS_OK);
 
   // Hold on to every window in memory so that window objects can't be
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory.xul
@@ -45,18 +45,17 @@
   const OTHER   = Ci.nsIMemoryReporter.KIND_OTHER;
 
   const BYTES = Ci.nsIMemoryReporter.UNITS_BYTES;
   const COUNT = Ci.nsIMemoryReporter.UNITS_COUNT;
   const COUNT_CUMULATIVE = Ci.nsIMemoryReporter.UNITS_COUNT_CUMULATIVE;
   const PERCENTAGE = Ci.nsIMemoryReporter.UNITS_PERCENTAGE;
 
   let fakeReporters = [
-    { name: "fake0",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP, aK, aU, aA) {
           aCbObj.callback("", aP, aK, aU, aA, "Desc.", aClosure);
         }
         f("heap-allocated",     OTHER,   BYTES, 500 * MB);
         f("heap-unallocated",   OTHER,   BYTES, 100 * MB);
         f("explicit/a",         HEAP,    BYTES, 222 * MB);
         f("explicit/b/a",       HEAP,    BYTES,  85 * MB);
         f("explicit/b/b",       HEAP,    BYTES,  75 * MB);
@@ -83,46 +82,43 @@
         f("other6/small",       OTHER,   COUNT, 1);
         // Check that a 0 / 0 is handled correctly.
         f("other7/zero",        OTHER,   BYTES, 0);
         // These compartments ones shouldn't be displayed.
         f("compartments/user/foo",   OTHER, COUNT, 1);
         f("compartments/system/foo", OTHER, COUNT, 1);
       }
     },
-    { name: "fake1",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP, aK, aU, aA) {
           aCbObj.callback("", aP, aK, aU, aA, "Desc.", aClosure);
         }
         f("explicit/c/d",     NONHEAP, BYTES,  13 * MB);
         f("explicit/c/d",     NONHEAP, BYTES,  10 * MB); // dup
         f("explicit/c/other", NONHEAP, BYTES,  77 * MB);
         f("explicit/cc",      NONHEAP, BYTES,  13 * MB);
         f("explicit/cc",      NONHEAP, BYTES,  10 * MB); // dup
         f("explicit/d",       NONHEAP, BYTES, 499 * KB); // omitted
         f("explicit/e",       NONHEAP, BYTES, 100 * KB); // omitted
         f("explicit/f/g/h/i", HEAP,    BYTES,  10 * MB);
         f("explicit/f/g/h/j", HEAP,    BYTES,  10 * MB);
       }
     },
-    { name: "fake2",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP, aK, aU, aA) {
           aCbObj.callback("", aP, aK, aU, aA, "Desc.", aClosure);
         }
         f("other3",           OTHER,   COUNT, 777);
         f("other2",           OTHER,   BYTES, 222 * MB);
         f("perc2",            OTHER,   PERCENTAGE, 10000);
         f("perc1",            OTHER,   PERCENTAGE, 4567);
         f("compartments/user/https:\\\\very-long-url.com\\very-long\\oh-so-long\\really-quite-long.html?a=2&b=3&c=4&d=5&e=abcdefghijklmnopqrstuvwxyz&f=123456789123456789123456789", OTHER, COUNT, 1);
       }
     },
-    { name: "compartments",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP) {
           aCbObj.callback("", aP, OTHER, COUNT, 1, "Desc.", aClosure);
         }
         f("compartments/user/bar");
         f("compartments/system/bar");
       }
     }
   ];
@@ -145,18 +141,17 @@
     is(ex.result, Cr.NS_ERROR_NOT_AVAILABLE, "mgr.explicit exception");
   }
  
   // The main process always comes first when we display about:memory.  The
   // remaining processes are sorted by their |resident| values (starting with
   // the largest).  Processes without a |resident| memory reporter are saved
   // for the end.
   let fakeReporters2 = [
-    { name: "fake3",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP1, aP2, aK, aU, aA) {
           aCbObj.callback(aP1, aP2, aK, aU, aA, "Desc.", aClosure);
         }
         f("2nd", "heap-allocated",  OTHER,   BYTES,1000* MB);
         f("2nd", "heap-unallocated",OTHER,   BYTES,100 * MB);
         f("2nd", "explicit/a/b/c",  HEAP,    BYTES,497 * MB);
         f("2nd", "explicit/a/b/c",  HEAP,    BYTES,  1 * MB); // dup: merge
         f("2nd", "explicit/a/b/c",  HEAP,    BYTES,  1 * MB); // dup: merge
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory2.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory2.xul
@@ -40,18 +40,17 @@
   const BYTES = Ci.nsIMemoryReporter.UNITS_BYTES;
 
   let hiPath  = "explicit/h/i";
   let hi2Path = "explicit/h/i2";
   let jkPath  = "explicit/j/k";
   let jk2Path = "explicit/j/k2";
 
   let fakeReporters = [
-    { name: "fake1",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP, aK, aA) {
           aCbObj.callback("", aP, aK, BYTES, aA, "Desc.", aClosure);
         }
         f("heap-allocated",     OTHER,   250 * MB);
         f("explicit/a/b",       HEAP,     50 * MB);
         f("explicit/a/c/d",     HEAP,     25 * MB);
         f("explicit/a/c/e",     HEAP,     15 * MB);
         f("explicit/a/f",       HEAP,     30 * MB);
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
@@ -35,18 +35,17 @@
   // Setup a minimal number of fake reporters.
   const KB = 1024;
   const MB = KB * KB;
   const HEAP  = Ci.nsIMemoryReporter.KIND_HEAP;
   const OTHER = Ci.nsIMemoryReporter.KIND_OTHER;
   const BYTES = Ci.nsIMemoryReporter.UNITS_BYTES;
 
   let fakeReporters = [
-    { name: "fake1",
-      collectReports: function(aCbObj, aClosure) {
+    { collectReports: function(aCbObj, aClosure) {
         function f(aP, aK, aA, aD) {
           aCbObj.callback("", aP, aK, BYTES, aA, aD, aClosure);
         }
         f("heap-allocated",     OTHER,   250 * MB, "Heap allocated.");
         f("explicit/a/b",       HEAP,     50 * MB, "A b.");
         f("other/a",            OTHER,   0.2 * MB, "Other a.");
         f("other/b",            OTHER,   0.1 * MB, "Other b.");
       }
--- a/toolkit/components/aboutmemory/tests/test_memoryReporters.xul
+++ b/toolkit/components/aboutmemory/tests/test_memoryReporters.xul
@@ -170,19 +170,16 @@
   mgr.sizeOfTab(window, jsObjectsSize, jsStringsSize, jsOtherSize,
                 domSize, styleSize, otherSize, totalSize,
                 jsMilliseconds, nonJSMilliseconds);
 
   let e = mgr.enumerateReporters();
   while (e.hasMoreElements()) {
     let r = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
     r.collectReports(handleReport, null);
-
-    // Access |name| to make sure it doesn't crash or assert.
-    dummy = r.name;
   }
 
   function checkSpecialReport(aName, aAmounts, aCanBeUnreasonable)
   {
     ok(aAmounts.length == 1, aName + " has " + aAmounts.length + " report");
     let n = aAmounts[0];
     // Check the size is reasonable -- i.e. not ridiculously large or small.
     ok((100 * 1000 <= n && n <= 10 * 1000 * 1000 * 1000) || aCanBeUnreasonable,
--- a/xpcom/base/nsIMemoryReporter.idl
+++ b/xpcom/base/nsIMemoryReporter.idl
@@ -142,27 +142,20 @@ interface nsIMemoryReporterCallback : ns
  *   heap-level allocation (e.g. malloc/calloc/operator new).  Reporters
  *   in this tree must have kind HEAP or NONHEAP, units BYTES, and a
  *   description that is a sentence (i.e. starts with a capital letter and
  *   ends with a period, or similar).
  *
  * - All other reports are unconstrained except that they must have a
  *   description that is a sentence.
  */
-[scriptable, uuid(53248304-124b-43cd-99dc-6e5797b91618)]
+[scriptable, uuid(0884cd0f-5829-4381-979b-0f53904030ed)]
 interface nsIMemoryReporter : nsISupports
 {
   /*
-   * The name of the reporter.  Useful when only one reporter needs to be run.
-   * Must be unique;  if reporters share names it's likely the wrong one will
-   * be called in certain circumstances.
-   */
-  readonly attribute ACString name;
-
-  /*
    * Run the reporter.
    */
   void collectReports(in nsIMemoryReporterCallback callback,
                       in nsISupports data);
 
   /*
    * Kinds.  See the |kind| comment in nsIMemoryReporterCallback.
    */
@@ -584,22 +577,16 @@ public:
   MemoryMultiReporter(const char* aName)
     : mName(aName)
   {}
 
   virtual ~MemoryMultiReporter() {}
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
-  NS_IMETHOD GetName(nsACString& aName)
-  {
-    aName.Assign(mName);
-    return NS_OK;
-  }
-
   NS_IMETHOD CollectReports(nsIMemoryReporterCallback* aCb,
                             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)