Bug 806473 - Expose MemoryInfoDumper methods via a nsIMemoryInfoDumper service. r=jlebar
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 29 Oct 2012 20:41:14 -0400
changeset 111858 963873ff3081ca3001cb884903bae0894ef84c2d
parent 111857 cb997ba8433bf03e4350a294ef7d52f756268d9a
child 111859 471b0731ff8dcb5b3441fada7b21848690c0ab6d
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjlebar
bugs806473
milestone19.0a1
Bug 806473 - Expose MemoryInfoDumper methods via a nsIMemoryInfoDumper service. r=jlebar
dom/ipc/ContentChild.cpp
xpcom/base/Makefile.in
xpcom/base/MemoryInfoDumper.cpp
xpcom/base/MemoryInfoDumper.h
xpcom/base/nsIMemoryInfoDumper.idl
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryInfoDumper.h
xpcom/base/nsMemoryReporterManager.cpp
xpcom/build/XPCOMModule.inc
xpcom/build/nsXPCOMCID.h
xpcom/build/nsXPComInit.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -15,17 +15,16 @@
 #include "ContentChild.h"
 #include "CrashReporterChild.h"
 #include "TabChild.h"
 #if defined(MOZ_SYDNEYAUDIO)
 #include "AudioChild.h"
 #endif
 
 #include "mozilla/Attributes.h"
-#include "mozilla/MemoryInfoDumper.h"
 #include "mozilla/dom/ExternalHelperAppChild.h"
 #include "mozilla/dom/PCrashReporterChild.h"
 #include "mozilla/dom/StorageChild.h"
 #include "mozilla/Hal.h"
 #include "mozilla/hal_sandbox/PHalChild.h"
 #include "mozilla/ipc/TestShellChild.h"
 #include "mozilla/ipc/XPCShellEnvironment.h"
 #include "mozilla/jsipc/PContextWrapperChild.h"
@@ -34,16 +33,17 @@
 #include "mozilla/layers/PCompositorChild.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/Preferences.h"
 
 #if defined(MOZ_SYDNEYAUDIO)
 #include "nsAudioStream.h"
 #endif
 #include "nsIMemoryReporter.h"
+#include "nsIMemoryInfoDumper.h"
 #include "nsIObserverService.h"
 #include "nsTObserverArray.h"
 #include "nsIObserver.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsServiceManagerUtils.h"
 #include "nsXULAppAPI.h"
 #include "nsWeakReference.h"
 #include "nsIScriptError.h"
@@ -443,26 +443,30 @@ ContentChild::DeallocPMemoryReportReques
     return true;
 }
 
 bool
 ContentChild::RecvDumpMemoryReportsToFile(const nsString& aIdentifier,
                                           const bool& aMinimizeMemoryUsage,
                                           const bool& aDumpChildProcesses)
 {
-    MemoryInfoDumper::DumpMemoryReportsToFile(
+    nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
+
+    dumper->DumpMemoryReportsToFile(
         aIdentifier, aMinimizeMemoryUsage, aDumpChildProcesses);
     return true;
 }
 
 bool
 ContentChild::RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
                                         const bool& aDumpChildProcesses)
 {
-    MemoryInfoDumper::DumpGCAndCCLogsToFile(
+    nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
+
+    dumper->DumpGCAndCCLogsToFile(
         aIdentifier, aDumpChildProcesses);
     return true;
 }
 
 PCompositorChild*
 ContentChild::AllocPCompositor(mozilla::ipc::Transport* aTransport,
                                base::ProcessId aOtherProcess)
 {
--- a/xpcom/base/Makefile.in
+++ b/xpcom/base/Makefile.in
@@ -36,17 +36,17 @@ CPPSRCS		= \
 		nsSystemInfo.cpp \
 		nsCycleCollector.cpp \
 		nsStackWalk.cpp \
 		nsMemoryReporterManager.cpp \
 		ClearOnShutdown.cpp \
 		VisualEventTracer.cpp \
 		nsErrorAsserts.cpp \
 		nsGZFileWriter.cpp \
-		MemoryInfoDumper.cpp \
+		nsMemoryInfoDumper.cpp \
 		nsMessageLoop.cpp \
 		$(NULL)
 
 ifeq ($(OS_ARCH),Linux)
 CPPSRCS += MapsMemoryReporter.cpp
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
@@ -69,17 +69,17 @@ EXPORTS		= \
 		nsGZFileWriter.h \
 		NSPRFormatTime.h \
 		$(NULL)
 
 EXPORTS_NAMESPACES = mozilla
 
 EXPORTS_mozilla = \
 	MapsMemoryReporter.h \
-	MemoryInfoDumper.h \
+	nsMemoryInfoDumper.h \
 	ClearOnShutdown.h \
 	StaticPtr.h \
 	AvailableMemoryTracker.h \
 	StackWalk.h \
 	VisualEventTracer.h \
 	$(NULL)
 
 ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
@@ -131,16 +131,17 @@ XPIDLSRCS	= \
 		nsICycleCollectorListener.idl \
 		nsIDebug2.idl \
 		nsIErrorService.idl \
 		nsIException.idl \
 		nsIExceptionService.idl \
 		nsIVersionComparator.idl \
 		nsIUUIDGenerator.idl \
 		nsIMutable.idl \
+		nsIMemoryInfoDumper.idl \
 		nsIMemoryReporter.idl \
 		nsIGZFileWriter.idl \
 		nsIMessageLoop.idl \
 		$(NULL)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 XPIDLSRCS	+= nsIMacUtils.idl
 endif
rename from xpcom/base/MemoryInfoDumper.h
rename to xpcom/base/nsIMemoryInfoDumper.idl
--- a/xpcom/base/MemoryInfoDumper.h
+++ b/xpcom/base/nsIMemoryInfoDumper.idl
@@ -1,57 +1,40 @@
 /* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=50 et cin tw=80 : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_MemoryInfoDumper_h
-#define mozilla_MemoryInfoDumper_h
-
-#include "nsString.h"
-#include "mozilla/StandardInteger.h"
-class nsIGZFileWriter;
-
-namespace mozilla {
+#include "nsISupports.idl"
 
-/**
- * This class facilitates dumping information about our memory usage to disk.
- *
- * Its cpp file also has Linux-only code which watches various OS signals and
- * dumps memory info upon receiving a signal.  You can activate these listeners
- * by calling Initialize().
- */
-class MemoryInfoDumper
+[scriptable, builtinclass, uuid(ede09623-d793-4355-9682-b3adfe307126)]
+interface nsIMemoryInfoDumper : nsISupports
 {
-public:
-  static void Initialize();
-
   /**
    * DumpMemoryReportsToFile dumps the memory reports for this process and
    * possibly our child processes (and their children, recursively) to a file in
    * the tmp directory called memory-reports-<identifier>-<pid>.json.gz (or
    * something similar, such as memory-reports-<identifier>-<pid>-1.json.gz; no
    * existing file will be overwritten).
    *
-   * @param identifier this identifier will appear in the filename of our
-   *   about:memory dump and those of our children (if dumpChildProcesses is
+   * @param aIdentifier this identifier will appear in the filename of our
+   *   about:memory dump and those of our children (if aDumpChildProcesses is
    *   true).
    *
    *   If the identifier is empty, the dumpMemoryReportsToFile implementation
    *   may set it arbitrarily and use that new value for its own dump and the
    *   dumps of its child processes.  For example, the dumpMemoryReportsToFile
-   *   implementation may set |identifier| to the number of seconds since the
+   *   implementation may set |aIdentifier| to the number of seconds since the
    *   epoch.
    *
-   * @param minimizeMemoryUsage indicates whether we should run a series of
+   * @param aMinimizeMemoryUsage indicates whether we should run a series of
    *   gc/cc's in an attempt to reduce our memory usage before collecting our
    *   memory report.
    *
-   * @param dumpChildProcesses indicates whether we should call
+   * @param aDumpChildProcesses indicates whether we should call
    *   dumpMemoryReportsToFile in our child processes.  If so, the child
    *   processes will also dump their children, and so on.
    *
    *
    * Sample output:
    *
    * {
    *   "hasMozMallocUsableSize":true,
@@ -114,20 +97,19 @@ public:
    *             "required": true
    *           }
    *         }
    *       }
    *     }
    *   }
    * }
    */
-  static void
-  DumpMemoryReportsToFile(const nsAString& aIdentifier,
-                          bool aMinimizeMemoryUsage,
-                          bool aDumpChildProcesses);
+  void dumpMemoryReportsToFile(in AString aIdentifier,
+                               in bool aMinimizeMemoryUsage,
+                               in bool aDumpChildProcesses);
 
   /**
    * Dump GC and CC logs to files in the OS's temp directory (or in
    * $MOZ_CC_LOG_DIRECTORY, if that environment variable is specified).
    *
    * @param aIdentifier If aIdentifier is non-empty, this string will appear in
    *   the filenames of the logs we create (both for this process and, if
    *   aDumpChildProcesses is true, for our child processes).
@@ -135,19 +117,11 @@ public:
    *   If aIdentifier is empty, the implementation may set it to an
    *   arbitrary value; for example, it may set aIdentifier to the number
    *   of seconds since the epoch.
    *
    * @param aDumpChildProcesses indicates whether we should call
    *   DumpGCAndCCLogsToFile in our child processes.  If so, the child processes
    *   will dump their children, and so on.
    */
-  static void
-  DumpGCAndCCLogsToFile(const nsAString& aIdentifier,
-                        bool aDumpChildProcesses);
-
-private:
-  static nsresult
-  DumpMemoryReportsToFileImpl(const nsAString& aIdentifier);
+  void dumpGCAndCCLogsToFile(in AString aIdentifier,
+                             in bool aDumpChildProcesses);
 };
-
-} // namespace mozilla
-#endif
rename from xpcom/base/MemoryInfoDumper.cpp
rename to xpcom/base/nsMemoryInfoDumper.cpp
--- a/xpcom/base/MemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=50 et cin tw=80 : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/MemoryInfoDumper.h"
+#include "mozilla/nsMemoryInfoDumper.h"
 
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/FileUtils.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/unused.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ContentChild.h"
 #include "nsIConsoleService.h"
@@ -50,17 +50,18 @@ public:
 
       : mIdentifier(aIdentifier)
       , mMinimizeMemoryUsage(aMinimizeMemoryUsage)
       , mDumpChildProcesses(aDumpChildProcesses)
   {}
 
   NS_IMETHOD Run()
   {
-    MemoryInfoDumper::DumpMemoryReportsToFile(
+    nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
+    dumper->DumpMemoryReportsToFile(
       mIdentifier, mMinimizeMemoryUsage, mDumpChildProcesses);
     return NS_OK;
   }
 
 private:
   const nsString mIdentifier;
   const bool mMinimizeMemoryUsage;
   const bool mDumpChildProcesses;
@@ -72,17 +73,18 @@ public:
   GCAndCCLogDumpRunnable(const nsAString& aIdentifier,
                          bool aDumpChildProcesses)
     : mIdentifier(aIdentifier)
     , mDumpChildProcesses(aDumpChildProcesses)
   {}
 
   NS_IMETHOD Run()
   {
-    MemoryInfoDumper::DumpGCAndCCLogsToFile(
+    nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
+    dumper->DumpGCAndCCLogsToFile(
       mIdentifier, mDumpChildProcesses);
     return NS_OK;
   }
 
 private:
   const nsString mIdentifier;
   const bool mDumpChildProcesses;
 };
@@ -265,18 +267,30 @@ InitializeSignalWatcher()
       FROM_HERE,
       NewRunnableMethod(sSignalPipeWatcher.get(),
                         &SignalPipeWatcher::Start));
 }
 
 } // anonymous namespace
 #endif // } XP_LINUX
 
+} // namespace mozilla
+
+NS_IMPL_ISUPPORTS1(nsMemoryInfoDumper, nsIMemoryInfoDumper)
+
+nsMemoryInfoDumper::nsMemoryInfoDumper()
+{
+}
+
+nsMemoryInfoDumper::~nsMemoryInfoDumper()
+{
+}
+
 /* static */ void
-MemoryInfoDumper::Initialize()
+nsMemoryInfoDumper::Initialize()
 {
 #ifdef XP_LINUX
   InitializeSignalWatcher();
 #endif
 }
 
 static void
 EnsureNonEmptyIdentifier(nsAString& aIdentifier)
@@ -287,18 +301,18 @@ EnsureNonEmptyIdentifier(nsAString& aIde
 
   // If the identifier is empty, set it to the number of whole seconds since the
   // epoch.  This identifier will appear in the files that this process
   // generates and also the files generated by this process's children, allowing
   // us to identify which files are from the same memory report request.
   aIdentifier.AppendInt(static_cast<int64_t>(PR_Now()) / 1000000);
 }
 
-/* static */ void
-MemoryInfoDumper::DumpMemoryReportsToFile(
+NS_IMETHODIMP
+nsMemoryInfoDumper::DumpMemoryReportsToFile(
     const nsAString& aIdentifier,
     bool aMinimizeMemoryUsage,
     bool aDumpChildProcesses)
 {
   nsString identifier(aIdentifier);
   EnsureNonEmptyIdentifier(identifier);
 
   // Kick off memory report dumps in our child processes, if applicable.  We
@@ -317,26 +331,26 @@ MemoryInfoDumper::DumpMemoryReportsToFil
   if (aMinimizeMemoryUsage) {
     // Minimize memory usage, then run DumpMemoryReportsToFile again.
     nsRefPtr<DumpMemoryReportsRunnable> callback =
       new DumpMemoryReportsRunnable(identifier,
           /* minimizeMemoryUsage = */ false,
           /* dumpChildProcesses = */ false);
     nsCOMPtr<nsIMemoryReporterManager> mgr =
       do_GetService("@mozilla.org/memory-reporter-manager;1");
-    NS_ENSURE_TRUE(mgr,);
+    NS_ENSURE_TRUE(mgr, NS_ERROR_FAILURE);
     mgr->MinimizeMemoryUsage(callback);
-    return;
+    return NS_OK;
   }
 
-  DumpMemoryReportsToFileImpl(identifier);
+  return DumpMemoryReportsToFileImpl(identifier);
 }
 
-/* static */ void
-MemoryInfoDumper::DumpGCAndCCLogsToFile(
+NS_IMETHODIMP
+nsMemoryInfoDumper::DumpGCAndCCLogsToFile(
   const nsAString& aIdentifier,
   bool aDumpChildProcesses)
 {
   nsString identifier(aIdentifier);
   EnsureNonEmptyIdentifier(identifier);
 
   if (aDumpChildProcesses) {
     nsTArray<ContentParent*> children;
@@ -347,18 +361,21 @@ MemoryInfoDumper::DumpGCAndCCLogsToFile(
     }
   }
 
   nsCOMPtr<nsICycleCollectorListener> logger =
     do_CreateInstance("@mozilla.org/cycle-collector-logger;1");
   logger->SetFilenameIdentifier(identifier);
 
   nsJSContext::CycleCollectNow(logger);
+  return NS_OK;
 }
 
+namespace mozilla {
+
 #define DUMP(o, s) \
   do { \
     nsresult rv = (o)->Write(s); \
     NS_ENSURE_SUCCESS(rv, rv); \
   } while (0)
 
 static nsresult
 DumpReport(nsIGZFileWriter *aWriter, bool aIsFirst,
@@ -446,18 +463,20 @@ class DumpMultiReporterCallback MOZ_FINA
       }
 };
 
 NS_IMPL_ISUPPORTS1(
     DumpMultiReporterCallback
     , nsIMemoryMultiReporterCallback
     )
 
+} // namespace mozilla
+
 /* static */ nsresult
-MemoryInfoDumper::DumpMemoryReportsToFileImpl(
+nsMemoryInfoDumper::DumpMemoryReportsToFileImpl(
   const nsAString& aIdentifier)
 {
   // Open a new file named something like
   //
   //   incomplete-memory-report-<-identifier>-<pid>-42.json.gz
   //
   // in NS_OS_TEMP_DIR for writing.  When we're finished writing the report,
   // we'll rename this file and get rid of the "incomplete-" prefix.
@@ -597,15 +616,14 @@ MemoryInfoDumper::DumpMemoryReportsToFil
     do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString path;
   tmpFile->GetPath(path);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString msg = NS_LITERAL_STRING(
-    "nsIMemoryReporterManager::dumpReports() dumped reports to ");
+    "nsIMemoryInfoDumper dumped reports to ");
   msg.Append(path);
   return cs->LogStringMessage(msg.get());
 }
 
 #undef DUMP
-} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/xpcom/base/nsMemoryInfoDumper.h
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set sw=2 ts=50 et cin tw=80 : */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_nsMemoryInfoDumper_h
+#define mozilla_nsMemoryInfoDumper_h
+
+#include "nsIMemoryInfoDumper.h"
+#include "nsString.h"
+
+/**
+ * This class facilitates dumping information about our memory usage to disk.
+ *
+ * Its cpp file also has Linux-only code which watches various OS signals and
+ * dumps memory info upon receiving a signal.  You can activate these listeners
+ * by calling Initialize().
+ */
+class nsMemoryInfoDumper : public nsIMemoryInfoDumper
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIMEMORYINFODUMPER
+
+  nsMemoryInfoDumper();
+  virtual ~nsMemoryInfoDumper();
+
+public:
+  static void Initialize();
+
+private:
+  static nsresult
+  DumpMemoryReportsToFileImpl(const nsAString& aIdentifier);
+};
+
+#define NS_MEMORY_INFO_DUMPER_CID \
+{ 0x00bd71fb, 0x7f09, 0x4ec3, \
+{ 0x96, 0xaf, 0xa0, 0xb5, 0x22, 0xb7, 0x79, 0x69 } }
+
+#endif
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -12,20 +12,20 @@
 #include "nsArrayEnumerator.h"
 #include "nsISimpleEnumerator.h"
 #include "nsIFile.h"
 #include "nsIFileStreams.h"
 #include "nsPrintfCString.h"
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
 #include "nsThread.h"
+#include "nsMemoryInfoDumper.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Services.h"
-#include "mozilla/MemoryInfoDumper.h"
 
 #ifndef XP_WIN
 #include <unistd.h>
 #endif
 
 using namespace mozilla;
 
 #if defined(MOZ_MEMORY)
@@ -600,17 +600,17 @@ nsMemoryReporterManager::Init()
 #ifdef HAVE_PRIVATE_REPORTER
     REGISTER(Private);
 #endif
 
 
     REGISTER(AtomTable);
 
 #if defined(XP_LINUX)
-    MemoryInfoDumper::Initialize();
+    nsMemoryInfoDumper::Initialize();
 #endif
 
     return NS_OK;
 }
 
 nsMemoryReporterManager::nsMemoryReporterManager()
   : mMutex("nsMemoryReporterManager::mMutex")
 {
--- a/xpcom/build/XPCOMModule.inc
+++ b/xpcom/build/XPCOMModule.inc
@@ -71,11 +71,12 @@
 #endif
 
 #if defined(MOZ_WIDGET_COCOA)
     COMPONENT(MACUTILSIMPL, nsMacUtilsImplConstructor)
 #endif
 
     COMPONENT(SYSTEMINFO, nsSystemInfoConstructor)
     COMPONENT(MEMORY_REPORTER_MANAGER, nsMemoryReporterManagerConstructor)
+    COMPONENT(MEMORY_INFO_DUMPER, nsMemoryInfoDumperConstructor)
     COMPONENT(IOUTIL, nsIOUtilConstructor)
     COMPONENT(CYCLE_COLLECTOR_LOGGER, nsCycleCollectorLoggerConstructor)
     COMPONENT(MESSAGE_LOOP, nsMessageLoopConstructor)
--- a/xpcom/build/nsXPCOMCID.h
+++ b/xpcom/build/nsXPCOMCID.h
@@ -66,16 +66,21 @@
 #define NS_IOUTIL_CONTRACTID "@mozilla.org/io-util;1"
 
 /**
  * Memory reporter service CID
  */
 #define NS_MEMORY_REPORTER_MANAGER_CONTRACTID "@mozilla.org/memory-reporter-manager;1"
 
 /**
+ * Memory info dumper service CID
+ */
+#define NS_MEMORY_INFO_DUMPER_CONTRACTID "@mozilla.org/memory-info-dumper;1"
+
+/**
  * Cycle collector logger contract id
  */
 #define NS_CYCLE_COLLECTOR_LOGGER_CONTRACTID "@mozilla.org/cycle-collector-logger;1"
 
 /**
  * nsMessageLoop contract id
  */
 #define NS_MESSAGE_LOOP_CONTRACTID "@mozilla.org/message-loop;1"
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -91,16 +91,17 @@ extern nsresult nsStringInputStreamConst
 #endif
 
 #ifdef MOZ_WIDGET_COCOA
 #include "nsMacUtilsImpl.h"
 #endif
 
 #include "nsSystemInfo.h"
 #include "nsMemoryReporterManager.h"
+#include "nsMemoryInfoDumper.h"
 #include "nsMessageLoop.h"
 
 #include <locale.h>
 #include "mozilla/Services.h"
 #include "mozilla/Omnijar.h"
 #include "mozilla/HangMonitor.h"
 #include "mozilla/Telemetry.h"
 
@@ -188,16 +189,18 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUU
 #ifdef MOZ_WIDGET_COCOA
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemInfo, Init)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMemoryReporterManager, Init)
 
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsMemoryInfoDumper)
+
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsIOUtil)
 
 static nsresult
 nsThreadManagerGetSingleton(nsISupports* outer,
                             const nsIID& aIID,
                             void* *aInstancePtr)
 {
     NS_ASSERTION(aInstancePtr, "null outptr");