--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -78,16 +78,18 @@ static RedirEntry kRedirMap[] = {
{ "buildconfig", "chrome://global/content/buildconfig.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
{ "license", "chrome://global/content/license.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
{ "licence", "chrome://global/content/license.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
{ "neterror", "chrome://global/content/netError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::ALLOW_SCRIPT },
+ { "memory", "chrome://global/content/aboutMemory.xhtml",
nsIAboutModule::ALLOW_SCRIPT }
};
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);
NS_IMETHODIMP
nsAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
{
NS_ENSURE_ARG_POINTER(aURI);
--- a/docshell/build/nsDocShellModule.cpp
+++ b/docshell/build/nsDocShellModule.cpp
@@ -199,16 +199,21 @@ static const nsModuleComponentInfo gDocS
NS_ABOUT_MODULE_CONTRACTID_PREFIX "licence",
nsAboutRedirector::Create
},
{ "about:neterror",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror",
nsAboutRedirector::Create
},
+ { "about:memory",
+ NS_ABOUT_REDIRECTOR_MODULE_CID,
+ NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory",
+ nsAboutRedirector::Create
+ },
// uriloader
{ "Netscape URI Loader Service", NS_URI_LOADER_CID, NS_URI_LOADER_CONTRACTID, nsURILoaderConstructor, },
{ "Netscape Doc Loader Service", NS_DOCUMENTLOADER_SERVICE_CID, NS_DOCUMENTLOADER_SERVICE_CONTRACTID,
nsDocLoaderConstructor, },
{ "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALHELPERAPPSERVICE_CONTRACTID,
nsOSHelperAppServiceConstructor, },
{ "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALPROTOCOLSERVICE_CONTRACTID,
--- a/toolkit/components/Makefile.in
+++ b/toolkit/components/Makefile.in
@@ -57,16 +57,17 @@ DIRS += \
filepicker \
console \
cookie \
exthelper \
viewconfig \
typeaheadfind \
parentalcontrols \
passwordmgr \
+ aboutmemory \
$(NULL)
ifneq (,$(filter cocoa, $(MOZ_WIDGET_TOOLKIT)))
TOOL_DIRS += alerts
else
DIRS += alerts
endif
new file mode 100644
--- /dev/null
+++ b/toolkit/components/aboutmemory/Makefile.in
@@ -0,0 +1,46 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Mozilla Password Manager code.
+#
+# The Initial Developer of the Original Code is
+# Brian Ryner.
+# Portions created by the Initial Developer are Copyright (C) 2003
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Brian Ryner <bryner@brianryner.com>
+# Justin Dolske <dolske@mozilla.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/toolkit/components/aboutmemory/content/aboutMemory.css
@@ -0,0 +1,79 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is about:memory.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Vladimir Vukicevic <vladimir@pobox.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+html {
+ background: -moz-dialog;
+}
+
+body {
+ margin: 0;
+ padding: 0 1em;
+ color: -moz-FieldText;
+ font: message-box;
+}
+
+h1 {
+ font-weight: bold;
+ font-size: x-large;
+}
+
+label {
+ -moz-user-select: text;
+}
+
+h2 {
+ margin-top: 0;
+ font-weight: bold;
+ font-size: large;
+}
+
+.memBox {
+ max-width: 30em;
+ background: white;
+ margin-top: 25px;
+ padding: 5px;
+ border: 1px solid black;
+ -moz-border-radius: 10px 10px;
+}
+
+.memValue {
+ text-align: right;
+}
+
+.memOverview table {
+ font-size: 120%;
+}
new file mode 100644
--- /dev/null
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -0,0 +1,170 @@
+/* -*- Mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is about:memory
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Vladimir Vukicevic <vladimir@pobox.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gMemReporters = { };
+
+function $(n) {
+ return document.getElementById(n);
+}
+
+function makeTableCell(s, c) {
+ var td = document.createElement("td");
+ var text = document.createTextNode(s);
+ td.appendChild(text);
+ if (c)
+ td.setAttribute("class", c);
+
+ return td;
+}
+
+function makeAbbrNode(str, title) {
+ var abbr = document.createElement("abbr");
+ var text = document.createTextNode(str);
+ abbr.appendChild(text);
+ abbr.setAttribute("title", title);
+
+ return abbr;
+}
+
+function makeTableRow() {
+ var row = document.createElement("tr");
+
+ for (var i = 0; i < arguments.length; ++i) {
+ var arg = arguments[i];
+ if (typeof(arg) == "string") {
+ row.appendChild(makeTableCell(arg));
+ } else if (arg.__proto__ == Array.prototype) {
+ row.appendChild(makeAbbrNode(arg[0], arg[1]));
+ } else {
+ row.appendChild(arg);
+ }
+ }
+
+ return row;
+}
+
+function setTextContent(node, s) {
+ while (node.lastChild)
+ node.removeChild(node.lastChild);
+
+ node.appendChild(document.createTextNode(s));
+}
+
+function formatNumber(n) {
+ var s = "";
+ var neg = false;
+ if (n < 0) {
+ neg = true;
+ n = -n;
+ }
+
+ do {
+ var k = n % 1000;
+ if (n > 999) {
+ if (k > 99)
+ s = k + s;
+ else if (k > 9)
+ s = "0" + k + s;
+ else
+ s = "00" + k + s;
+ } else {
+ s = k + s;
+ }
+
+ n = Math.floor(n / 1000);
+ if (n > 0)
+ s = "," + s;
+ } while (n > 0);
+
+ return s;
+}
+
+function updateMemoryStatus()
+{
+ // if we have the standard reporters for mapped/allocated, put
+ // those at the top
+ if ("malloc/mapped" in gMemReporters &&
+ "malloc/allocated" in gMemReporters)
+ {
+ // committed is the total amount of memory that we've touched, that is that we have
+ // some kind of backing store for
+ setTextContent($("memMappedValue"),
+ formatNumber(gMemReporters["malloc/mapped"].memoryUsed));
+
+ // allocated is the amount of committed memory that we're actively using (i.e., that isn't free)
+ setTextContent($("memInUseValue"),
+ formatNumber(gMemReporters["malloc/allocated"].memoryUsed));
+ } else {
+ $("memOverview").style.display = "none";
+ }
+
+ var mo = $("memOtherRows");
+ while (mo.lastChild)
+ mo.removeChild(mo.lastChild);
+
+ var otherCount = 0;
+ for each (var rep in gMemReporters) {
+ var row = makeTableRow([rep.path, rep.description],
+ makeTableCell(formatNumber(rep.memoryUsed), "memValue"));
+
+ mo.appendChild(row);
+
+ otherCount++;
+ }
+
+ if (otherCount == 0) {
+ var row = makeTableRow("No other information available.");
+ mo.appendChild(row);
+ }
+}
+
+function doLoad()
+{
+ var mgr = Components
+ .classes["@mozilla.org/memory-reporter-manager;1"]
+ .getService(Components.interfaces.nsIMemoryReporterManager);
+
+ var e = mgr.enumerateReporters();
+ while (e.hasMoreElements()) {
+ var mr = e.getNext().QueryInterface(Components.interfaces.nsIMemoryReporter);
+ gMemReporters[mr.path] = mr;
+ }
+
+ updateMemoryStatus();
+}
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/aboutmemory/content/aboutMemory.xhtml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+
+<!-- ***** BEGIN LICENSE BLOCK *****
+ - Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ -
+ - The contents of this file are subject to the Mozilla Public License Version
+ - 1.1 (the "License"); you may not use this file except in compliance with
+ - the License. You may obtain a copy of the License at
+ - http://www.mozilla.org/MPL/
+ -
+ - Software distributed under the License is distributed on an "AS IS" basis,
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ - for the specific language governing rights and limitations under the
+ - License.
+ -
+ - The Original Code is about:memory.
+ -
+ - The Initial Developer of the Original Code is
+ - Mozilla Corp
+ - Portions created by the Initial Developer are Copyright (C) 2009
+ - the Initial Developer. All Rights Reserved.
+ -
+ - Contributor(s):
+ - Vladimir Vukicevic <vladimir@pobox.com>
+ -
+ - Alternatively, the contents of this file may be used under the terms of
+ - either the GNU General Public License Version 2 or later (the "GPL"), or
+ - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ - in which case the provisions of the GPL or the LGPL are applicable instead
+ - of those above. If you wish to allow use of your version of this file only
+ - under the terms of either the GPL or the LGPL, and not to allow others to
+ - use your version of this file under the terms of the MPL, indicate your
+ - decision by deleting the provisions above and replace them with the notice
+ - and other provisions required by the LGPL or the GPL. If you do not delete
+ - the provisions above, a recipient may use your version of this file under
+ - the terms of any one of the MPL, the GPL or the LGPL.
+ -
+ - ***** END LICENSE BLOCK ***** -->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>about:memory</title>
+
+ <link rel="stylesheet" href="chrome://global/content/aboutMemory.css" type="text/css"/>
+
+ <script type="text/javascript" src="chrome://global/content/aboutMemory.js"/>
+ </head>
+
+ <body onload="doLoad()">
+ <h1>Memory Usage</h1>
+
+ <div id="memOverview" class="memOverview memBox">
+ <h2>Overview</h2>
+ <table border="0">
+ <tbody>
+ <tr><td width="100%">Memory mapped:</td><td id="memMappedValue" class="memValue"></td></tr>
+ <tr><td>Memory in use:</td><td id="memInUseValue" class="memValue"></td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div id="memOther" class="memOther memBox">
+ <h2>Other Information</h2>
+ <table border="0">
+ <thead>
+ <tr><th style="text-align: left" width="100%">Description</th><th>Value</th></tr>
+ </thead>
+ <tbody id="memOtherRows">
+ </tbody>
+ </table>
+ </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/aboutmemory/jar.mn
@@ -0,0 +1,4 @@
+toolkit.jar:
++ content/global/aboutMemory.js (content/aboutMemory.js)
++ content/global/aboutMemory.xhtml (content/aboutMemory.xhtml)
++ content/global/aboutMemory.css (content/aboutMemory.css)
--- a/xpcom/base/nsIMemoryReporter.idl
+++ b/xpcom/base/nsIMemoryReporter.idl
@@ -77,16 +77,21 @@ interface nsIMemoryReporterManager : nsI
* Manager service will hold a strong reference to the given reporter.
*/
void registerReporter (in nsIMemoryReporter reporter);
/*
* Unregister the given memory reporter.
*/
void unregisterReporter (in nsIMemoryReporter reporter);
+
+ /*
+ * Initialize.
+ */
+ void init ();
};
%{C++
#define NS_MEMORY_REPORTER_IMPLEMENT(_classname,_path,_desc,_usageFunction,_dataptr) \
class MemoryReporter_##_classname : public nsIMemoryReporter { \
public: \
NS_DECL_ISUPPORTS \
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1,18 +1,206 @@
+/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * mozilla.org
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Vladimir Vukicevic <vladimir@pobox.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#include "nsMemoryReporterManager.h"
#include "nsArrayEnumerator.h"
+/**
+ ** memory reporter implementation for jemalloc and OSX malloc,
+ ** to obtain info on total memory in use (that we know about,
+ ** at least -- on OSX, there are sometimes other zones in use).
+ **/
+
+/* Because of the way that jemalloc is linked on linux, we can't
+ * get to jemalloc_stats(). So just do this on Windows until
+ * that's fixed.
+ */
+#if defined(MOZ_MEMORY) && defined(XP_WIN)
+#define HAVE_JEMALLOC_STATS 1
+#else
+#undef HAVE_JEMALLOC_STATS
+#endif
+
+#if defined(HAVE_JEMALLOC_STATS)
+#define HAVE_MALLOC_REPORTERS 1
+#include "jemalloc.h"
+
+PRInt64 getMallocMapped(void *) {
+ jemalloc_stats_t stats;
+ jemalloc_stats(&stats);
+ return (PRInt64) stats.mapped;
+}
+
+PRInt64 getMallocAllocated(void *) {
+ jemalloc_stats_t stats;
+ jemalloc_stats(&stats);
+ return (PRInt64) stats.allocated;
+}
+
+PRInt64 getMallocCommitted(void *) {
+ jemalloc_stats_t stats;
+ jemalloc_stats(&stats);
+ return (PRInt64) stats.committed;
+}
+
+PRInt64 getMallocDirty(void *) {
+ jemalloc_stats_t stats;
+ jemalloc_stats(&stats);
+ return (PRInt64) stats.dirty;
+}
+
+#elif defined(XP_MACOSX) && !defined(MOZ_MEMORY)
+#define HAVE_MALLOC_REPORTERS 1
+#include <malloc/malloc.h>
+
+static PRInt64 getMallocAllocated(void *) {
+ struct mstats stats = mstats();
+ return (PRInt64) stats.bytes_used;
+}
+
+static PRInt64 getMallocMapped(void *) {
+ struct mstats stats = mstats();
+ return (PRInt64) stats.bytes_total;
+}
+
+static PRInt64 getMallocDefaultCommitted(void *) {
+ malloc_statistics_t stats;
+ malloc_zone_statistics(malloc_default_zone(), &stats);
+ return stats.size_in_use;
+}
+
+static PRInt64 getMallocDefaultAllocated(void *) {
+ malloc_statistics_t stats;
+ malloc_zone_statistics(malloc_default_zone(), &stats);
+ return stats.size_allocated;
+}
+
+#endif
+
+
+#ifdef HAVE_MALLOC_REPORTERS
+NS_MEMORY_REPORTER_IMPLEMENT(MallocAllocated,
+ "malloc/allocated",
+ "Malloc bytes allocated (in use by application)",
+ getMallocAllocated,
+ NULL)
+
+NS_MEMORY_REPORTER_IMPLEMENT(MallocMapped,
+ "malloc/mapped",
+ "Malloc bytes mapped (not necessarily committed)",
+ getMallocMapped,
+ NULL)
+
+#if defined(HAVE_JEMALLOC_STATS)
+NS_MEMORY_REPORTER_IMPLEMENT(MallocCommitted,
+ "malloc/committed",
+ "Malloc bytes commited (readable/writable)",
+ getMallocCommitted,
+ NULL)
+
+NS_MEMORY_REPORTER_IMPLEMENT(MallocDirty,
+ "malloc/dirty",
+ "Malloc bytes dirty (committed unused pages)",
+ getMallocDirty,
+ NULL)
+#elif defined(XP_MACOSX) && !defined(MOZ_MEMORY)
+NS_MEMORY_REPORTER_IMPLEMENT(MallocDefaultCommitted,
+ "malloc/zone0/committed",
+ "Malloc bytes commited (r/w) in default zone",
+ getMallocDefaultCommitted,
+ NULL)
+
+NS_MEMORY_REPORTER_IMPLEMENT(MallocDefaultAllocated,
+ "malloc/zone0/allocated",
+ "Malloc bytes allocated (in use) in default zone",
+ getMallocDefaultAllocated,
+ NULL)
+#endif
+
+#endif
+
+/**
+ ** nsMemoryReporterManager implementation
+ **/
+
NS_IMPL_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager)
NS_IMETHODIMP
+nsMemoryReporterManager::Init()
+{
+ nsCOMPtr<nsIMemoryReporter> mr;
+
+ /*
+ * Register our core jemalloc/malloc reporters
+ */
+#ifdef HAVE_MALLOC_REPORTERS
+ mr = new NS_MEMORY_REPORTER_NAME(MallocAllocated);
+ RegisterReporter(mr);
+
+ mr = new NS_MEMORY_REPORTER_NAME(MallocMapped);
+ RegisterReporter(mr);
+
+#if defined(HAVE_JEMALLOC_STATS)
+ mr = new NS_MEMORY_REPORTER_NAME(MallocCommitted);
+ RegisterReporter(mr);
+
+ mr = new NS_MEMORY_REPORTER_NAME(MallocDirty);
+ RegisterReporter(mr);
+#elif defined(XP_MACOSX) && !defined(MOZ_MEMORY)
+ mr = new NS_MEMORY_REPORTER_NAME(MallocDefaultCommitted);
+ RegisterReporter(mr);
+
+ mr = new NS_MEMORY_REPORTER_NAME(MallocDefaultAllocated);
+ RegisterReporter(mr);
+#endif
+#endif
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsMemoryReporterManager::EnumerateReporters(nsISimpleEnumerator **result)
{
return NS_NewArrayEnumerator(result, mReporters);
}
NS_IMETHODIMP
nsMemoryReporterManager::RegisterReporter(nsIMemoryReporter *reporter)
{
--- a/xpcom/build/nsXPCOMCID.h
+++ b/xpcom/build/nsXPCOMCID.h
@@ -93,16 +93,21 @@
/**
* IO utilities service contract id.
* This guarantees implementation of nsIIOUtil. Usable from any thread.
*/
#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"
+
+/**
* The following are the CIDs and Contract IDs of the nsISupports wrappers for
* primative types.
*/
#define NS_SUPPORTS_ID_CID \
{ 0xacf8dc40, 0x4a25, 0x11d3, \
{ 0x98, 0x90, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } }
#define NS_SUPPORTS_ID_CONTRACTID "@mozilla.org/supports-id;1"
--- a/xpcom/build/nsXPCOMCIDInternal.h
+++ b/xpcom/build/nsXPCOMCIDInternal.h
@@ -73,21 +73,16 @@
/**
* The global proxy object manager. This component is a singleton.
* @implement nsIProxyObjectManager
*/
#define NS_XPCOMPROXY_CONTRACTID "@mozilla.org/xpcomproxy;1"
/**
- * Memory reporter service CID
- */
-#define NS_MEMORY_REPORTER_MANAGER_CONTRACTID "@mozilla.org/memory-reporter-manager;1"
-
-/**
* The contract id for the nsIXULAppInfo service.
*/
#define XULAPPINFO_SERVICE_CONTRACTID \
"@mozilla.org/xre/app-info;1"
/**
* The contract id for the nsIXULRuntime service.
*/
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -227,17 +227,17 @@ NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(n
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init)
#ifdef XP_MACOSX
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemInfo, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsMemoryReporterManager)
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMemoryReporterManager, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIOUtil)
static NS_METHOD
nsThreadManagerGetSingleton(nsISupports* outer,
const nsIID& aIID,
void* *aInstancePtr)
{