From 5b3dec5013517feaa5c32fec42f37ee55f6b3dbf Mon Sep 17 00:00:00 2001 From: Roy Tam Date: Mon, 23 Jul 2018 15:29:44 +0800 Subject: [PATCH] cherry-picked upstream change - Bug 798914 - Consolidate MallocSizeOf typedefs --- caps/src/nsNullPrincipalURI.cpp | 7 +++- caps/src/nsNullPrincipalURI.h | 5 ++- content/base/public/FragmentOrElement.h | 3 +- content/base/public/nsINode.h | 3 +- content/base/src/FragmentOrElement.cpp | 5 ++- content/base/src/Link.cpp | 3 +- content/base/src/Link.h | 3 +- content/base/src/nsAttrAndChildArray.cpp | 3 +- content/base/src/nsAttrAndChildArray.h | 3 +- content/base/src/nsAttrValue.cpp | 3 +- content/base/src/nsAttrValue.h | 3 +- content/base/src/nsDOMAttributeMap.cpp | 5 ++- content/base/src/nsDOMAttributeMap.h | 3 +- content/base/src/nsDocument.cpp | 7 ++-- content/base/src/nsDocument.h | 3 +- content/base/src/nsGenericDOMDataNode.cpp | 3 +- content/base/src/nsINode.cpp | 3 +- content/base/src/nsMappedAttributes.cpp | 3 +- content/base/src/nsMappedAttributes.h | 3 +- content/base/src/nsPropertyTable.cpp | 9 +++-- content/base/src/nsPropertyTable.h | 3 +- content/base/src/nsTextFragment.cpp | 3 +- content/base/src/nsTextFragment.h | 3 +- content/base/src/nsXMLHttpRequest.cpp | 3 +- content/base/src/nsXMLHttpRequest.h | 3 +- content/canvas/src/WebGLBuffer.h | 3 +- content/canvas/src/WebGLElementArrayCache.cpp | 5 ++- content/canvas/src/WebGLElementArrayCache.h | 3 +- content/canvas/src/WebGLShader.cpp | 3 +- content/canvas/src/WebGLShader.h | 3 +- content/events/src/nsEventListenerManager.cpp | 3 +- content/events/src/nsEventListenerManager.h | 3 +- .../html/content/src/HTMLAnchorElement.cpp | 4 +- content/html/content/src/HTMLAreaElement.cpp | 4 +- content/html/content/src/HTMLLinkElement.cpp | 3 +- dom/base/Navigator.cpp | 3 +- dom/base/Navigator.h | 3 +- dom/base/nsGlobalWindow.cpp | 3 +- dom/base/nsIJSEventListener.h | 5 ++- dom/base/nsISizeOfEventTarget.h | 3 +- dom/base/nsScriptNameSpaceManager.cpp | 7 ++-- dom/base/nsScriptNameSpaceManager.h | 3 +- dom/base/nsWindowMemoryReporter.h | 7 ++-- dom/src/events/nsJSEventListener.h | 3 +- gfx/thebes/gfxASurface.cpp | 5 ++- gfx/thebes/gfxASurface.h | 5 ++- gfx/thebes/gfxDWriteFontList.cpp | 13 ++++--- gfx/thebes/gfxDWriteFontList.h | 13 ++++--- gfx/thebes/gfxDWriteFonts.cpp | 7 +++- gfx/thebes/gfxDWriteFonts.h | 5 ++- gfx/thebes/gfxFT2FontList.cpp | 5 ++- gfx/thebes/gfxFT2FontList.h | 6 ++- gfx/thebes/gfxFT2Fonts.cpp | 5 ++- gfx/thebes/gfxFT2Fonts.h | 5 ++- gfx/thebes/gfxFont.cpp | 37 +++++++++--------- gfx/thebes/gfxFont.h | 39 ++++++++++--------- gfx/thebes/gfxFontUtils.h | 5 ++- gfx/thebes/gfxGDIFont.cpp | 7 +++- gfx/thebes/gfxGDIFont.h | 5 ++- gfx/thebes/gfxGDIFontList.cpp | 8 ++-- gfx/thebes/gfxGDIFontList.h | 7 ++-- gfx/thebes/gfxImageSurface.cpp | 5 ++- gfx/thebes/gfxImageSurface.h | 5 ++- gfx/thebes/gfxMacFont.cpp | 7 +++- gfx/thebes/gfxMacFont.h | 5 ++- gfx/thebes/gfxMacPlatformFontList.h | 3 +- gfx/thebes/gfxMacPlatformFontList.mm | 3 +- gfx/thebes/gfxPlatformFontList.cpp | 21 +++++----- gfx/thebes/gfxPlatformFontList.h | 7 ++-- image/src/FrameBlender.cpp | 3 +- image/src/FrameBlender.h | 3 +- image/src/Image.h | 5 ++- image/src/ImageWrapper.cpp | 6 ++- image/src/ImageWrapper.h | 5 ++- image/src/RasterImage.cpp | 7 ++-- image/src/RasterImage.h | 7 ++-- image/src/VectorImage.cpp | 5 ++- image/src/VectorImage.h | 5 ++- image/src/imgFrame.cpp | 3 +- image/src/imgFrame.h | 3 +- ipc/chromium/src/base/histogram.cc | 4 +- ipc/chromium/src/base/histogram.h | 9 ++--- js/public/HashTable.h | 13 ++++--- js/public/MemoryMetrics.h | 6 ++- js/public/Utility.h | 5 --- js/public/Vector.h | 9 +++-- js/src/ctypes/CTypes.cpp | 3 +- js/src/ds/LifoAlloc.h | 7 ++-- js/src/gc/Zone.h | 3 +- js/src/jit/BaselineJIT.cpp | 4 +- js/src/jit/BaselineJIT.h | 6 ++- js/src/jit/Ion.cpp | 4 +- js/src/jit/Ion.h | 4 +- js/src/jit/IonCode.h | 3 +- js/src/jit/IonCompartment.h | 4 +- js/src/jsapi.h | 9 +++-- js/src/jscntxt.cpp | 5 ++- js/src/jscntxt.h | 5 ++- js/src/jscompartment.cpp | 3 +- js/src/jscompartment.h | 5 ++- js/src/jsfriendapi.h | 3 +- js/src/jsgc.cpp | 3 +- js/src/jsgc.h | 5 ++- js/src/jsinfer.cpp | 9 +++-- js/src/jsinfer.h | 4 +- js/src/jsiter.cpp | 3 +- js/src/jsiter.h | 5 ++- js/src/jsmath.cpp | 3 +- js/src/jsmath.h | 4 +- js/src/jsobj.cpp | 3 +- js/src/jsobj.h | 5 ++- js/src/jsscript.cpp | 5 ++- js/src/jsscript.h | 7 ++-- js/src/vm/ArgumentsObject-inl.h | 4 +- js/src/vm/ArgumentsObject.h | 4 +- js/src/vm/RegExpObject.cpp | 4 +- js/src/vm/RegExpObject.h | 3 +- js/src/vm/RegExpStatics-inl.h | 4 +- js/src/vm/RegExpStatics.h | 4 +- js/src/vm/Shape.h | 5 ++- js/src/vm/Stack.h | 4 +- js/src/vm/String.cpp | 3 +- js/src/vm/String.h | 3 +- js/xpconnect/src/XPCJSRuntime.cpp | 3 +- js/xpconnect/src/XPCMaps.cpp | 19 ++++----- js/xpconnect/src/XPCMaps.h | 22 ++++++----- js/xpconnect/src/XPCWrappedNativeInfo.cpp | 5 ++- js/xpconnect/src/XPCWrappedNativeScope.cpp | 5 ++- js/xpconnect/src/xpcprivate.h | 11 +++--- layout/base/FramePropertyTable.cpp | 7 +++- layout/base/FramePropertyTable.h | 7 ++-- layout/base/StackArena.cpp | 4 +- layout/base/StackArena.h | 3 +- layout/base/nsIPresShell.h | 3 +- layout/base/nsLayoutUtils.cpp | 3 +- layout/base/nsLayoutUtils.h | 3 +- layout/base/nsPresArena.cpp | 5 ++- layout/base/nsPresArena.h | 5 ++- layout/base/nsPresContext.cpp | 5 ++- layout/base/nsPresContext.h | 9 +++-- layout/base/nsPresShell.cpp | 5 ++- layout/base/nsPresShell.h | 5 ++- layout/base/nsStyleSheetService.cpp | 7 ++-- layout/base/nsStyleSheetService.h | 5 ++- layout/generic/nsTextRunTransformations.cpp | 6 ++- layout/generic/nsTextRunTransformations.h | 5 ++- layout/style/AnimationCommon.cpp | 5 ++- layout/style/AnimationCommon.h | 5 ++- layout/style/Declaration.cpp | 3 +- layout/style/Declaration.h | 3 +- layout/style/GroupRule.h | 5 ++- layout/style/ImportRule.h | 3 +- layout/style/Loader.cpp | 7 ++-- layout/style/Loader.h | 3 +- layout/style/NameSpaceRule.h | 3 +- layout/style/Rule.h | 5 ++- layout/style/StyleRule.cpp | 12 +++--- layout/style/StyleRule.h | 11 +++--- layout/style/nsAnimationManager.cpp | 7 +++- layout/style/nsAnimationManager.h | 5 ++- layout/style/nsCSSDataBlock.cpp | 3 +- layout/style/nsCSSDataBlock.h | 3 +- layout/style/nsCSSRuleProcessor.cpp | 21 +++++----- layout/style/nsCSSRuleProcessor.h | 5 ++- layout/style/nsCSSRules.cpp | 27 ++++++------- layout/style/nsCSSRules.h | 19 ++++----- layout/style/nsCSSStyleSheet.cpp | 5 ++- layout/style/nsCSSStyleSheet.h | 5 ++- layout/style/nsCSSValue.cpp | 27 ++++++------- layout/style/nsCSSValue.h | 27 ++++++------- layout/style/nsHTMLCSSStyleSheet.cpp | 5 ++- layout/style/nsHTMLCSSStyleSheet.h | 5 ++- layout/style/nsHTMLStyleSheet.cpp | 9 +++-- layout/style/nsHTMLStyleSheet.h | 7 ++-- layout/style/nsIStyleRuleProcessor.h | 5 ++- layout/style/nsIStyleSheet.h | 3 +- layout/style/nsLayoutStylesheetCache.cpp | 5 ++- layout/style/nsLayoutStylesheetCache.h | 5 ++- layout/style/nsStyleSet.cpp | 3 +- layout/style/nsStyleSet.h | 3 +- layout/style/nsTransitionManager.cpp | 5 ++- layout/style/nsTransitionManager.h | 5 ++- memory/replace/dmd/DMD.cpp | 3 +- mfbt/MemoryReporting.h | 30 ++++++++++++++ mfbt/exported_headers.mk | 1 + modules/libpref/src/Preferences.cpp | 3 +- modules/libpref/src/nsPrefBranch.h | 3 +- modules/libpref/src/prefapi.cpp | 3 +- modules/libpref/src/prefapi_private_data.h | 4 +- netwerk/base/src/nsSimpleURI.cpp | 5 ++- netwerk/base/src/nsSimpleURI.h | 5 ++- netwerk/base/src/nsStandardURL.cpp | 5 ++- netwerk/base/src/nsStandardURL.h | 5 ++- netwerk/cache/nsDiskCacheBinding.cpp | 5 ++- netwerk/cache/nsDiskCacheBinding.h | 3 +- netwerk/cache/nsDiskCacheBlockFile.cpp | 3 +- netwerk/cache/nsDiskCacheBlockFile.h | 3 +- netwerk/cache/nsDiskCacheDevice.cpp | 3 +- netwerk/cache/nsDiskCacheDevice.h | 3 +- netwerk/cache/nsDiskCacheMap.cpp | 3 +- netwerk/cache/nsDiskCacheMap.h | 3 +- netwerk/cache/nsDiskCacheStreams.cpp | 3 +- netwerk/cache/nsDiskCacheStreams.h | 3 +- netwerk/dns/nsEffectiveTLDService.cpp | 3 +- netwerk/dns/nsEffectiveTLDService.h | 3 +- startupcache/StartupCache.cpp | 5 ++- startupcache/StartupCache.h | 7 ++-- toolkit/components/places/History.cpp | 5 ++- toolkit/components/places/History.h | 5 ++- .../components/places/tests/cpp/mock_Link.h | 5 ++- .../nsUrlClassifierPrefixSet.cpp | 3 +- .../url-classifier/nsUrlClassifierPrefixSet.h | 3 +- xpcom/base/CycleCollectedJSRuntime.cpp | 3 +- xpcom/base/CycleCollectedJSRuntime.h | 3 +- xpcom/base/nsCycleCollector.cpp | 13 ++++--- xpcom/base/nsISizeOf.h | 5 ++- xpcom/base/nscore.h | 6 --- xpcom/components/nsCategoryManager.cpp | 7 ++-- xpcom/components/nsCategoryManager.h | 5 ++- xpcom/components/nsComponentManager.cpp | 9 +++-- xpcom/components/nsComponentManager.h | 5 ++- xpcom/ds/nsAtomTable.cpp | 11 +++--- xpcom/ds/nsAtomTable.h | 3 +- xpcom/glue/nsBaseHashtable.h | 11 +++--- xpcom/glue/nsCOMArray.cpp | 5 ++- xpcom/glue/nsCOMArray.h | 9 +++-- xpcom/glue/nsTArray.h | 5 ++- xpcom/glue/nsTHashtable.h | 9 +++-- xpcom/glue/nsTObserverArray.h | 3 +- xpcom/glue/nsVoidArray.cpp | 5 ++- xpcom/glue/nsVoidArray.h | 5 ++- xpcom/glue/pldhash.cpp | 7 ++-- xpcom/glue/pldhash.h | 7 ++-- .../xptinfo/public/XPTInterfaceInfoManager.h | 3 +- .../xptinfo/src/xptiInterfaceInfoManager.cpp | 3 +- xpcom/string/public/nsStringBuffer.h | 8 ++-- xpcom/string/public/nsTSubstring.h | 13 ++++--- xpcom/string/src/nsSubstring.cpp | 8 ++-- xpcom/string/src/nsTSubstring.cpp | 13 ++++--- xpcom/typelib/xpt/public/xpt_arena.h | 6 +-- xpcom/typelib/xpt/src/xpt_arena.c | 3 +- 241 files changed, 859 insertions(+), 562 deletions(-) create mode 100644 mfbt/MemoryReporting.h diff --git a/caps/src/nsNullPrincipalURI.cpp b/caps/src/nsNullPrincipalURI.cpp index 5c9405488..28d7ff5dd 100644 --- a/caps/src/nsNullPrincipalURI.cpp +++ b/caps/src/nsNullPrincipalURI.cpp @@ -5,6 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsNullPrincipalURI.h" + +#include "mozilla/MemoryReporting.h" + #include "nsNetUtil.h" #include "nsEscape.h" #include "nsCRT.h" @@ -272,14 +275,14 @@ nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs) //// nsISizeOf size_t -nsNullPrincipalURI::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsNullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf); } size_t -nsNullPrincipalURI::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { +nsNullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/caps/src/nsNullPrincipalURI.h b/caps/src/nsNullPrincipalURI.h index f4c3b27c2..7ab5d8b9b 100644 --- a/caps/src/nsNullPrincipalURI.h +++ b/caps/src/nsNullPrincipalURI.h @@ -16,6 +16,7 @@ #include "nsAutoPtr.h" #include "nsString.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" // {51fcd543-3b52-41f7-b91b-6b54102236e6} #define NS_NULLPRINCIPALURI_IMPLEMENTATION_CID \ @@ -30,8 +31,8 @@ public: NS_DECL_NSIURI // nsISizeOf - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsNullPrincipalURI(const nsCString &aSpec); diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h index 98135e93b..acecd0d55 100644 --- a/content/base/public/FragmentOrElement.h +++ b/content/base/public/FragmentOrElement.h @@ -13,6 +13,7 @@ #define FragmentOrElement_h___ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsAttrAndChildArray.h" // member #include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_* #include "nsIContent.h" // base class @@ -298,7 +299,7 @@ public: void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL); void Unlink(bool aIsXUL); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; /** * The .style attribute (an interface that forwards to the actual diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index e321b1ac4..fd1544884 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -17,6 +17,7 @@ #include "nsPropertyTable.h" // for typedefs #include "nsTObserverArray.h" // for member #include "nsWindowMemoryReporter.h" // for NS_DECL_SIZEOF_EXCLUDING_THIS +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/EventTarget.h" // for base class // Including 'windows.h' will #define GetClassInfo to something else. @@ -299,7 +300,7 @@ public: // way that |this| points to the start of the allocated object, even in // methods of nsINode's sub-classes, and so |aMallocSizeOf(this)| is always // safe to call no matter which object it was invoked on. - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp index e89bc5af9..cfca8d700 100644 --- a/content/base/src/FragmentOrElement.cpp +++ b/content/base/src/FragmentOrElement.cpp @@ -10,6 +10,7 @@ * utility methods for subclasses, and so forth. */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/Likely.h" @@ -592,7 +593,7 @@ FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL) } size_t -FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); @@ -1831,7 +1832,7 @@ FragmentOrElement::FireNodeRemovedForChildren() } size_t -FragmentOrElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +FragmentOrElement::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; n += nsIContent::SizeOfExcludingThis(aMallocSizeOf); diff --git a/content/base/src/Link.cpp b/content/base/src/Link.cpp index d289b53d5..45e823b37 100644 --- a/content/base/src/Link.cpp +++ b/content/base/src/Link.cpp @@ -6,6 +6,7 @@ #include "Link.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsEventStates.h" #include "nsIURL.h" @@ -546,7 +547,7 @@ Link::SetHrefAttribute(nsIURI *aURI) } size_t -Link::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; diff --git a/content/base/src/Link.h b/content/base/src/Link.h index 72a6c8e36..4218e3cdd 100644 --- a/content/base/src/Link.h +++ b/content/base/src/Link.h @@ -12,6 +12,7 @@ #define mozilla_dom_Link_h__ #include "mozilla/IHistory.h" +#include "mozilla/MemoryReporting.h" #include "nsIContent.h" namespace mozilla { @@ -103,7 +104,7 @@ public: virtual bool HasDeferredDNSPrefetchRequest() { return true; } virtual size_t - SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; bool ElementHasHref() const; diff --git a/content/base/src/nsAttrAndChildArray.cpp b/content/base/src/nsAttrAndChildArray.cpp index c1ad139ba..8b2742088 100644 --- a/content/base/src/nsAttrAndChildArray.cpp +++ b/content/base/src/nsAttrAndChildArray.cpp @@ -10,6 +10,7 @@ #include "nsAttrAndChildArray.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/CheckedInt.h" #include "nsMappedAttributeElement.h" @@ -871,7 +872,7 @@ nsAttrAndChildArray::SetChildAtPos(void** aPos, nsIContent* aChild, } size_t -nsAttrAndChildArray::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsAttrAndChildArray::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; if (mImpl) { diff --git a/content/base/src/nsAttrAndChildArray.h b/content/base/src/nsAttrAndChildArray.h index fc260dbba..442de2792 100644 --- a/content/base/src/nsAttrAndChildArray.h +++ b/content/base/src/nsAttrAndChildArray.h @@ -12,6 +12,7 @@ #define nsAttrAndChildArray_h___ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nscore.h" #include "nsAttrName.h" @@ -116,7 +117,7 @@ public: !AttrSlotIsTaken(ATTRCHILD_ARRAY_MAX_ATTR_COUNT - 1); } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; bool HasMappedAttrs() const { return MappedAttrCount(); diff --git a/content/base/src/nsAttrValue.cpp b/content/base/src/nsAttrValue.cpp index 932fad100..70fd5b78c 100644 --- a/content/base/src/nsAttrValue.cpp +++ b/content/base/src/nsAttrValue.cpp @@ -15,6 +15,7 @@ #include "nsAttrValueInlines.h" #include "nsIAtom.h" #include "nsUnicharUtils.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/StyleRule.h" #include "mozilla/css/Declaration.h" #include "nsContentUtils.h" @@ -1949,7 +1950,7 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict, } size_t -nsAttrValue::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsAttrValue::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; diff --git a/content/base/src/nsAttrValue.h b/content/base/src/nsAttrValue.h index 7298a66e7..473bd74b8 100644 --- a/content/base/src/nsAttrValue.h +++ b/content/base/src/nsAttrValue.h @@ -21,6 +21,7 @@ #include "SVGAttrValueWrapper.h" #include "nsTArrayForwardDeclare.h" #include "nsIAtom.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/BindingDeclarations.h" class nsAString; @@ -371,7 +372,7 @@ public: bool ParseStyleAttribute(const nsAString& aString, nsStyledElementNotElementCSSInlineStyle* aElement); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: // These have to be the same as in ValueType diff --git a/content/base/src/nsDOMAttributeMap.cpp b/content/base/src/nsDOMAttributeMap.cpp index 2a2628070..7c4faa3b5 100644 --- a/content/base/src/nsDOMAttributeMap.cpp +++ b/content/base/src/nsDOMAttributeMap.cpp @@ -9,6 +9,7 @@ #include "nsDOMAttributeMap.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Attr.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/MozNamedAttrMapBinding.h" @@ -533,14 +534,14 @@ nsDOMAttributeMap::Enumerate(AttrCache::EnumReadFunction aFunc, size_t AttrCacheSizeEnumerator(const nsAttrKey& aKey, const nsRefPtr& aValue, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { return aMallocSizeOf(aValue.get()); } size_t -nsDOMAttributeMap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsDOMAttributeMap::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mAttributeCache.SizeOfExcludingThis(AttrCacheSizeEnumerator, diff --git a/content/base/src/nsDOMAttributeMap.h b/content/base/src/nsDOMAttributeMap.h index f4fb093fe..f4db2a8a4 100644 --- a/content/base/src/nsDOMAttributeMap.h +++ b/content/base/src/nsDOMAttributeMap.h @@ -10,6 +10,7 @@ #ifndef nsDOMAttributeMap_h #define nsDOMAttributeMap_h +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Attr.h" #include "mozilla/ErrorResult.h" #include "nsCycleCollectionParticipant.h" @@ -181,7 +182,7 @@ public: // No supported names we want to show up in iteration. } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: nsCOMPtr mContent; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index af1cdb588..7393fd21a 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -9,6 +9,7 @@ */ #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/Likely.h" #include @@ -454,7 +455,7 @@ nsIdentifierMapEntry::HasIdElementExposedAsHTMLDocumentProperty() // static size_t nsIdentifierMapEntry::SizeOfExcludingThis(nsIdentifierMapEntry* aEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void*) { return aEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf); @@ -11181,14 +11182,14 @@ nsIDocument::DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const static size_t SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aData) { return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf); } size_t -nsDocument::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsDocument::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { // This SizeOfExcludingThis() overrides the one from nsINode. But // nsDocuments can only appear at the top of the DOM tree, and we use the diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index d898de3c5..bbe48162e 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -62,6 +62,7 @@ #include "nsISecurityEventSink.h" #include "nsIChannelEventSink.h" #include "imgIRequest.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/DOMImplementation.h" #include "nsIDOMTouchEvent.h" #include "nsIInlineEventHandlers.h" @@ -224,7 +225,7 @@ public: }; static size_t SizeOfExcludingThis(nsIdentifierMapEntry* aEntry, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* aArg); private: diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 69ee693ba..bc27a7fff 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -11,6 +11,7 @@ #include "mozilla/DebugOnly.h" #include "nsGenericDOMDataNode.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsIDocument.h" #include "nsEventListenerManager.h" @@ -924,7 +925,7 @@ nsGenericDOMDataNode::GetClassAttributeName() const } size_t -nsGenericDOMDataNode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsGenericDOMDataNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = nsIContent::SizeOfExcludingThis(aMallocSizeOf); n += mText.SizeOfExcludingThis(aMallocSizeOf); diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index f1ee1f9d7..eb9bfccc4 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -15,6 +15,7 @@ #include "mozAutoDocUpdate.h" #include "mozilla/CORSMode.h" #include "mozilla/Likely.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "nsAsyncDOMEvent.h" #include "nsAttrValueOrString.h" @@ -2091,7 +2092,7 @@ nsINode::UnbindObject(nsISupports* aObject) } size_t -nsINode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; nsEventListenerManager* elm = diff --git a/content/base/src/nsMappedAttributes.cpp b/content/base/src/nsMappedAttributes.cpp index bd5dbeb00..6b5f93527 100644 --- a/content/base/src/nsMappedAttributes.cpp +++ b/content/base/src/nsMappedAttributes.cpp @@ -12,6 +12,7 @@ #include "nsHTMLStyleSheet.h" #include "nsRuleWalker.h" #include "mozilla/HashFunctions.h" +#include "mozilla/MemoryReporting.h" using namespace mozilla; @@ -248,7 +249,7 @@ nsMappedAttributes::IndexOfAttr(nsIAtom* aLocalName) const } size_t -nsMappedAttributes::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsMappedAttributes::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { NS_ASSERTION(mAttrCount == mBufferSize, "mBufferSize and mAttrCount are expected to be the same."); diff --git a/content/base/src/nsMappedAttributes.h b/content/base/src/nsMappedAttributes.h index 5477a0361..4954495e1 100644 --- a/content/base/src/nsMappedAttributes.h +++ b/content/base/src/nsMappedAttributes.h @@ -15,6 +15,7 @@ #include "nsMappedAttributeElement.h" #include "nsIStyleRule.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" class nsIAtom; class nsHTMLStyleSheet; @@ -77,7 +78,7 @@ public: virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE; #endif - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: nsMappedAttributes(const nsMappedAttributes& aCopy); diff --git a/content/base/src/nsPropertyTable.cpp b/content/base/src/nsPropertyTable.cpp index 61823bc3e..9808ddd7e 100644 --- a/content/base/src/nsPropertyTable.cpp +++ b/content/base/src/nsPropertyTable.cpp @@ -21,6 +21,9 @@ */ #include "nsPropertyTable.h" + +#include "mozilla/MemoryReporting.h" + #include "pldhash.h" #include "nsError.h" #include "nsIAtom.h" @@ -52,7 +55,7 @@ public: return mName == aPropertyName; } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); nsCOMPtr mName; // property name PLDHashTable mObjectValueMap; // map of object/value pairs @@ -340,7 +343,7 @@ nsPropertyTable::PropertyList::DeletePropertyFor(nsPropertyOwner aObject) } size_t -nsPropertyTable::PropertyList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsPropertyTable::PropertyList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { size_t n = aMallocSizeOf(this); n += PL_DHashTableSizeOfExcludingThis(&mObjectValueMap, nullptr, aMallocSizeOf); @@ -348,7 +351,7 @@ nsPropertyTable::PropertyList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSize } size_t -nsPropertyTable::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsPropertyTable::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; diff --git a/content/base/src/nsPropertyTable.h b/content/base/src/nsPropertyTable.h index 7ca2646f5..849122cdd 100644 --- a/content/base/src/nsPropertyTable.h +++ b/content/base/src/nsPropertyTable.h @@ -23,6 +23,7 @@ #ifndef nsPropertyTable_h_ #define nsPropertyTable_h_ +#include "mozilla/MemoryReporting.h" #include "nscore.h" class nsIAtom; @@ -176,7 +177,7 @@ class nsPropertyTable class PropertyList; - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: NS_HIDDEN_(void) DestroyPropertyList(); diff --git a/content/base/src/nsTextFragment.cpp b/content/base/src/nsTextFragment.cpp index 8aa630702..1641ef5b7 100644 --- a/content/base/src/nsTextFragment.cpp +++ b/content/base/src/nsTextFragment.cpp @@ -16,6 +16,7 @@ #include "nsBidiUtils.h" #include "nsUnicharUtils.h" #include "nsUTF8Utils.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/SSE.h" #include "nsTextFragmentImpl.h" #include @@ -392,7 +393,7 @@ nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateB } /* virtual */ size_t -nsTextFragment::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsTextFragment::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { if (Is2b()) { return aMallocSizeOf(m2b); diff --git a/content/base/src/nsTextFragment.h b/content/base/src/nsTextFragment.h index 1a9d74429..93bf86675 100644 --- a/content/base/src/nsTextFragment.h +++ b/content/base/src/nsTextFragment.h @@ -12,6 +12,7 @@ #define nsTextFragment_h___ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsString.h" #include "nsReadableUtils.h" @@ -174,7 +175,7 @@ public: uint32_t mLength : 29; }; - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: void ReleaseText(); diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 3c00ea855..f7336a0fb 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -4,6 +4,7 @@ * 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/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/CheckedInt.h" @@ -536,7 +537,7 @@ nsXMLHttpRequest::DisconnectFromOwner() size_t nsXMLHttpRequest::SizeOfEventTargetIncludingThis( - nsMallocSizeOfFun aMallocSizeOf) const + MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mResponseBody.SizeOfExcludingThisIfUnshared(aMallocSizeOf); diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index 3bc496ed6..5c512b294 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -39,6 +39,7 @@ #include "nsIInputStream.h" #include "mozilla/Assertions.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/TypedArray.h" #include "mozilla/dom/XMLHttpRequestBinding.h" @@ -229,7 +230,7 @@ public: // nsISizeOfEventTarget virtual size_t - SizeOfEventTargetIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + SizeOfEventTargetIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsXHREventTarget) diff --git a/content/canvas/src/WebGLBuffer.h b/content/canvas/src/WebGLBuffer.h index 718011e57..cd4060dcb 100644 --- a/content/canvas/src/WebGLBuffer.h +++ b/content/canvas/src/WebGLBuffer.h @@ -13,6 +13,7 @@ #include "nsWrapperCache.h" #include "mozilla/LinkedList.h" +#include "mozilla/MemoryReporting.h" namespace mozilla { @@ -32,7 +33,7 @@ public: void Delete(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t sizeOfCache = mCache ? mCache->SizeOfIncludingThis(aMallocSizeOf) : 0; return aMallocSizeOf(this) + sizeOfCache; } diff --git a/content/canvas/src/WebGLElementArrayCache.cpp b/content/canvas/src/WebGLElementArrayCache.cpp index 578093550..e40099666 100644 --- a/content/canvas/src/WebGLElementArrayCache.cpp +++ b/content/canvas/src/WebGLElementArrayCache.cpp @@ -7,6 +7,7 @@ #include "nsTArray.h" #include "mozilla/Assertions.h" +#include "mozilla/MemoryReporting.h" #include #include @@ -306,7 +307,7 @@ public: void Update(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + mTreeData.SizeOfExcludingThis(aMallocSizeOf); } @@ -558,7 +559,7 @@ bool WebGLElementArrayCache::Validate(GLenum type, uint32_t maxAllowed, size_t f return false; } -size_t WebGLElementArrayCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { +size_t WebGLElementArrayCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t uint8TreeSize = mUint8Tree ? mUint8Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint16TreeSize = mUint16Tree ? mUint16Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint32TreeSize = mUint32Tree ? mUint32Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; diff --git a/content/canvas/src/WebGLElementArrayCache.h b/content/canvas/src/WebGLElementArrayCache.h index 68d1f582e..19276a1ea 100644 --- a/content/canvas/src/WebGLElementArrayCache.h +++ b/content/canvas/src/WebGLElementArrayCache.h @@ -6,6 +6,7 @@ #ifndef WEBGLELEMENTARRAYCACHE_H #define WEBGLELEMENTARRAYCACHE_H +#include "mozilla/MemoryReporting.h" #include "mozilla/StandardInteger.h" #include "nscore.h" #include "GLDefs.h" @@ -47,7 +48,7 @@ public: ~WebGLElementArrayCache(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: diff --git a/content/canvas/src/WebGLShader.cpp b/content/canvas/src/WebGLShader.cpp index 1a0aae743..fe02d6563 100644 --- a/content/canvas/src/WebGLShader.cpp +++ b/content/canvas/src/WebGLShader.cpp @@ -6,6 +6,7 @@ #include "WebGLObjectModel.h" #include "WebGLShader.h" #include "WebGLContext.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/WebGLRenderingContextBinding.h" #include "nsContentUtils.h" @@ -39,7 +40,7 @@ WebGLShader::Delete() { } size_t -WebGLShader::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { +WebGLShader::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + mSource.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + mTranslationLog.SizeOfExcludingThisIfUnshared(aMallocSizeOf); diff --git a/content/canvas/src/WebGLShader.h b/content/canvas/src/WebGLShader.h index 4cc73862c..fb6ce919d 100644 --- a/content/canvas/src/WebGLShader.h +++ b/content/canvas/src/WebGLShader.h @@ -14,6 +14,7 @@ #include "angle/ShaderLang.h" #include "mozilla/LinkedList.h" +#include "mozilla/MemoryReporting.h" namespace mozilla { @@ -39,7 +40,7 @@ public: DeleteOnce(); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; WebGLuint GLName() { return mGLName; } WebGLenum ShaderType() { return mType; } diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 9726fd37a..3a2294f4c 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -24,6 +24,7 @@ #include "nsLayoutUtils.h" #include "nsINameSpaceManager.h" #include "nsIContent.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsIFrame.h" #include "nsView.h" @@ -1302,7 +1303,7 @@ nsEventListenerManager::GetEventHandlerInternal(nsIAtom *aEventName) } size_t -nsEventListenerManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsEventListenerManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); diff --git a/content/events/src/nsEventListenerManager.h b/content/events/src/nsEventListenerManager.h index fe4c47f73..3e5d9c698 100644 --- a/content/events/src/nsEventListenerManager.h +++ b/content/events/src/nsEventListenerManager.h @@ -18,6 +18,7 @@ #include "nsTObserverArray.h" #include "nsGUIEvent.h" #include "nsIJSEventListener.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/EventTarget.h" #include "mozilla/dom/EventListenerBinding.h" @@ -400,7 +401,7 @@ public: bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; void MarkForCC(); diff --git a/content/html/content/src/HTMLAnchorElement.cpp b/content/html/content/src/HTMLAnchorElement.cpp index e03854a9f..e60f47b31 100644 --- a/content/html/content/src/HTMLAnchorElement.cpp +++ b/content/html/content/src/HTMLAnchorElement.cpp @@ -5,6 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/HTMLAnchorElement.h" + +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/HTMLAnchorElementBinding.h" #include "nsCOMPtr.h" @@ -413,7 +415,7 @@ HTMLAnchorElement::IntrinsicState() const } size_t -HTMLAnchorElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +HTMLAnchorElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) + Link::SizeOfExcludingThis(aMallocSizeOf); diff --git a/content/html/content/src/HTMLAreaElement.cpp b/content/html/content/src/HTMLAreaElement.cpp index 741520bd3..c6530fabe 100644 --- a/content/html/content/src/HTMLAreaElement.cpp +++ b/content/html/content/src/HTMLAreaElement.cpp @@ -5,6 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/HTMLAreaElement.h" + +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/HTMLAreaElementBinding.h" #include "base/compiler_specific.h" @@ -232,7 +234,7 @@ HTMLAreaElement::IntrinsicState() const } size_t -HTMLAreaElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +HTMLAreaElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) + Link::SizeOfExcludingThis(aMallocSizeOf); diff --git a/content/html/content/src/HTMLLinkElement.cpp b/content/html/content/src/HTMLLinkElement.cpp index 44f8e8b12..c66021922 100644 --- a/content/html/content/src/HTMLLinkElement.cpp +++ b/content/html/content/src/HTMLLinkElement.cpp @@ -5,6 +5,7 @@ #include "mozilla/dom/HTMLLinkElement.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/HTMLLinkElementBinding.h" #include "base/compiler_specific.h" #include "nsGenericHTMLElement.h" @@ -389,7 +390,7 @@ HTMLLinkElement::IntrinsicState() const } size_t -HTMLLinkElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +HTMLLinkElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) + Link::SizeOfExcludingThis(aMallocSizeOf); diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 330291ba5..074162913 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -11,6 +11,7 @@ #include "nsIXULAppInfo.h" #include "nsPluginArray.h" #include "nsMimeTypeArray.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/DesktopNotification.h" #include "nsGeolocation.h" #include "nsIHttpProtocolHandler.h" @@ -1570,7 +1571,7 @@ Navigator::GetMozCameras(nsISupports** aCameraManager) } size_t -Navigator::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +Navigator::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 24bc76c9c..0646ac62c 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -7,6 +7,7 @@ #ifndef mozilla_dom_Navigator_h #define mozilla_dom_Navigator_h +#include "mozilla/MemoryReporting.h" #include "nsIDOMNavigator.h" #include "nsIDOMNavigatorGeolocation.h" #include "nsIDOMNavigatorDeviceStorage.h" @@ -200,7 +201,7 @@ public: static bool HasDesktopNotificationSupport(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; /** * For use during document.write where our inner window changes. diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 971c00b41..8e58d97a1 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -8,6 +8,7 @@ #include /* This must occur *after* base/basictypes.h to avoid typedefs conflicts. */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" // Local Includes @@ -11385,7 +11386,7 @@ nsGlobalWindow::HasIndexedDBSupport() static size_t SizeOfEventTargetObjectsEntryExcludingThisFun( nsPtrHashKey *aEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void *arg) { nsISupports *supports = aEntry->GetKey(); diff --git a/dom/base/nsIJSEventListener.h b/dom/base/nsIJSEventListener.h index 55baa7639..dc033542f 100644 --- a/dom/base/nsIJSEventListener.h +++ b/dom/base/nsIJSEventListener.h @@ -11,6 +11,7 @@ #include "xpcpublic.h" #include "nsIDOMEventListener.h" #include "nsIAtom.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/EventHandlerBinding.h" #define NS_IJSEVENTLISTENER_IID \ @@ -241,7 +242,7 @@ public: mHandler.SetHandler(aHandler); } - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return 0; @@ -257,7 +258,7 @@ public: // - mEventName: shared with others } - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/dom/base/nsISizeOfEventTarget.h b/dom/base/nsISizeOfEventTarget.h index 6a9d0405f..718b5cac8 100644 --- a/dom/base/nsISizeOfEventTarget.h +++ b/dom/base/nsISizeOfEventTarget.h @@ -7,6 +7,7 @@ #ifndef nsISizeOfEventTarget_h___ #define nsISizeOfEventTarget_h___ +#include "mozilla/MemoryReporting.h" #include "nsISupports.h" #define NS_ISIZEOFEVENTTARGET_IID \ @@ -31,7 +32,7 @@ public: * itself. */ virtual size_t - SizeOfEventTargetIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0; + SizeOfEventTargetIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsISizeOfEventTarget, NS_ISIZEOFEVENTTARGET_IID) diff --git a/dom/base/nsScriptNameSpaceManager.cpp b/dom/base/nsScriptNameSpaceManager.cpp index bf7e2af65..5520a6265 100644 --- a/dom/base/nsScriptNameSpaceManager.cpp +++ b/dom/base/nsScriptNameSpaceManager.cpp @@ -27,6 +27,7 @@ #include "nsCRT.h" #include "nsIObserverService.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" @@ -43,7 +44,7 @@ public: nsString mKey; nsGlobalNameStruct mGlobalName; - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) { + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) { // Measurement of the following members may be added later if DMD finds it // is worthwhile: // - mGlobalName @@ -810,7 +811,7 @@ nsScriptNameSpaceManager::EnumerateGlobalNames(GlobalNameEnumerator aEnumerator, } static size_t -SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, nsMallocSizeOfFun aMallocSizeOf, +SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, MallocSizeOf aMallocSizeOf, void *aArg) { GlobalNameMapEntry* entry = static_cast(aHdr); @@ -818,7 +819,7 @@ SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, nsMallocSizeOfFun aMallocSizeOf, } size_t -nsScriptNameSpaceManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsScriptNameSpaceManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = 0; n += PL_DHashTableSizeOfExcludingThis(&mGlobalNames, diff --git a/dom/base/nsScriptNameSpaceManager.h b/dom/base/nsScriptNameSpaceManager.h index bbcce5d94..1d5600168 100644 --- a/dom/base/nsScriptNameSpaceManager.h +++ b/dom/base/nsScriptNameSpaceManager.h @@ -21,6 +21,7 @@ #ifndef nsScriptNameSpaceManager_h__ #define nsScriptNameSpaceManager_h__ +#include "mozilla/MemoryReporting.h" #include "nsIScriptNameSpaceManager.h" #include "nsString.h" #include "nsID.h" @@ -156,7 +157,7 @@ public: void EnumerateGlobalNames(GlobalNameEnumerator aEnumerator, void* aClosure); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: // Adds a new entry to the hash and returns the nsGlobalNameStruct diff --git a/dom/base/nsWindowMemoryReporter.h b/dom/base/nsWindowMemoryReporter.h index 2ea5ca01e..77b37d88b 100644 --- a/dom/base/nsWindowMemoryReporter.h +++ b/dom/base/nsWindowMemoryReporter.h @@ -12,6 +12,7 @@ #include "nsDataHashtable.h" #include "nsWeakReference.h" #include "nsAutoPtr.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "nsArenaMemoryStats.h" #include "mozilla/Attributes.h" @@ -21,15 +22,15 @@ // SizeOfExcludingThis from its super-class. SizeOfIncludingThis() need not be // defined, it is inherited from nsINode. #define NS_DECL_SIZEOF_EXCLUDING_THIS \ - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; class nsWindowSizes { public: - nsWindowSizes(nsMallocSizeOfFun aMallocSizeOf) { + nsWindowSizes(mozilla::MallocSizeOf aMallocSizeOf) { memset(this, 0, sizeof(nsWindowSizes)); mMallocSizeOf = aMallocSizeOf; } - nsMallocSizeOfFun mMallocSizeOf; + mozilla::MallocSizeOf mMallocSizeOf; nsArenaMemoryStats mArenaStats; size_t mDOMElementNodes; size_t mDOMTextNodes; diff --git a/dom/src/events/nsJSEventListener.h b/dom/src/events/nsJSEventListener.h index 5570b6e81..bc8e83e57 100644 --- a/dom/src/events/nsJSEventListener.h +++ b/dom/src/events/nsJSEventListener.h @@ -7,6 +7,7 @@ #define nsJSEventListener_h__ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsIDOMKeyEvent.h" #include "nsIJSEventListener.h" #include "nsIDOMEventListener.h" @@ -33,7 +34,7 @@ public: // nsIJSEventListener - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index f7d189b1e..884837c47 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -8,6 +8,7 @@ #include "mozilla/Base64.h" #include "mozilla/CheckedInt.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "gfxASurface.h" #include "gfxContext.h" @@ -671,14 +672,14 @@ gfxASurface::RecordMemoryFreed() } size_t -gfxASurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxASurface::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { // We don't measure mSurface because cairo doesn't allow it. return 0; } size_t -gfxASurface::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxASurface::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/gfx/thebes/gfxASurface.h b/gfx/thebes/gfxASurface.h index 53b2bd755..a4af6c161 100644 --- a/gfx/thebes/gfxASurface.h +++ b/gfx/thebes/gfxASurface.h @@ -10,6 +10,7 @@ #define MOZ_DUMP_IMAGES #endif +#include "mozilla/MemoryReporting.h" #include "gfxTypes.h" #include "gfxRect.h" #include "nsAutoPtr.h" @@ -210,8 +211,8 @@ public: virtual int32_t KnownMemoryUsed() { return mBytesRecorded; } - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; // gfxASurface has many sub-classes. This method indicates if a sub-class // is capable of measuring its own size accurately. If not, the caller // must fall back to a computed size. (Note that gfxASurface can actually diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index 82aa65758..6bb5cda2b 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -3,6 +3,7 @@ * 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/MemoryReporting.h" #include "mozilla/Util.h" #ifdef MOZ_LOGGING @@ -212,7 +213,7 @@ gfxDWriteFontFamily::LocalizedName(nsAString &aLocalizedName) } void -gfxDWriteFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFontFamily::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { gfxFontFamily::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -221,7 +222,7 @@ gfxDWriteFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxDWriteFontFamily::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFontFamily::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); @@ -554,7 +555,7 @@ gfxDWriteFontEntry::IsCJKFont() } void -gfxDWriteFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFontEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { gfxFontEntry::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -563,7 +564,7 @@ gfxDWriteFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxDWriteFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); @@ -1208,7 +1209,7 @@ gfxDWriteFontList::ResolveFontName(const nsAString& aFontName, } void -gfxDWriteFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFontList::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { gfxPlatformFontList::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -1226,7 +1227,7 @@ gfxDWriteFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxDWriteFontList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFontList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index 7c56ec1b6..1a1c17372 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -6,6 +6,7 @@ #ifndef GFX_DWRITEFONTLIST_H #define GFX_DWRITEFONTLIST_H +#include "mozilla/MemoryReporting.h" #include "gfxDWriteCommon.h" #include "gfxFont.h" @@ -48,9 +49,9 @@ public: void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; } - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; protected: @@ -152,9 +153,9 @@ public: void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; } bool GetForceGDIClassic() { return mForceGDIClassic; } - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; protected: @@ -365,9 +366,9 @@ public: gfxFloat GetForceGDIClassicMaxFontSize() { return mForceGDIClassicMaxFontSize; } - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; private: diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index c43870a94..094a98aa7 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "gfxDWriteFonts.h" + +#include "mozilla/MemoryReporting.h" + #include "gfxDWriteShaper.h" #include "gfxHarfBuzzShaper.h" #include @@ -668,7 +671,7 @@ gfxDWriteFont::MeasureGlyphWidth(uint16_t aGlyph) } void -gfxDWriteFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFont::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -677,7 +680,7 @@ gfxDWriteFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxDWriteFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxDWriteFont::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { aSizes->mFontInstances += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxDWriteFonts.h b/gfx/thebes/gfxDWriteFonts.h index 660c2a955..6d3e365b1 100644 --- a/gfx/thebes/gfxDWriteFonts.h +++ b/gfx/thebes/gfxDWriteFonts.h @@ -6,6 +6,7 @@ #ifndef GFX_WINDOWSDWRITEFONTS_H #define GFX_WINDOWSDWRITEFONTS_H +#include "mozilla/MemoryReporting.h" #include #include "gfxFont.h" @@ -58,9 +59,9 @@ public: virtual mozilla::TemporaryRef GetGlyphRenderingOptions(); - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; virtual FontType GetType() const { return FONT_TYPE_DWRITE; } diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 19d9356a4..7214d2b90 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -3,6 +3,7 @@ * 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/MemoryReporting.h" #include "mozilla/Util.h" #if defined(MOZ_WIDGET_GTK2) @@ -464,7 +465,7 @@ FT2FontEntry::CopyFontTable(uint32_t aTableTag, } void -FT2FontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +FT2FontEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { gfxFontEntry::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -473,7 +474,7 @@ FT2FontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -FT2FontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +FT2FontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index ddfedbee7..098ba9658 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -6,6 +6,8 @@ #ifndef GFX_FT2FONTLIST_H #define GFX_FT2FONTLIST_H +#include "mozilla/MemoryReporting.h" + #ifdef XP_WIN #include "gfxWindowsPlatform.h" #include @@ -74,9 +76,9 @@ public: // accordingly so that we avoid using bad font tables void CheckForBrokenFont(gfxFontFamily *aFamily); - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; FT_Face mFTFace; diff --git a/gfx/thebes/gfxFT2Fonts.cpp b/gfx/thebes/gfxFT2Fonts.cpp index 3da4ad6f3..02209d861 100644 --- a/gfx/thebes/gfxFT2Fonts.cpp +++ b/gfx/thebes/gfxFT2Fonts.cpp @@ -35,6 +35,7 @@ #include "prlog.h" #include "prinit.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" // rounding and truncation functions for a Freetype floating point number @@ -642,7 +643,7 @@ gfxFT2Font::FillGlyphDataForChar(uint32_t ch, CachedGlyphData *gd) } void -gfxFT2Font::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFT2Font::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -651,7 +652,7 @@ gfxFT2Font::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxFT2Font::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFT2Font::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { aSizes->mFontInstances += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxFT2Fonts.h b/gfx/thebes/gfxFT2Fonts.h index fd64e7681..014b1f03b 100644 --- a/gfx/thebes/gfxFT2Fonts.h +++ b/gfx/thebes/gfxFT2Fonts.h @@ -6,6 +6,7 @@ #ifndef GFX_FT2FONTS_H #define GFX_FT2FONTS_H +#include "mozilla/MemoryReporting.h" #include "cairo.h" #include "gfxTypes.h" #include "gfxFont.h" @@ -63,9 +64,9 @@ public: // new functions return &entry->mData; } - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; protected: diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 4fae5127c..ba85e3916 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -35,6 +35,7 @@ #include "nsStyleConsts.h" #include "mozilla/FloatingPoint.h" #include "mozilla/Likely.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "gfxSVGGlyphs.h" @@ -348,10 +349,10 @@ public: mHashKey = 0; } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return mTableData.SizeOfExcludingThis(aMallocSizeOf); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } @@ -599,7 +600,7 @@ gfxFontEntry::CheckForGraphiteTables() /* static */ size_t gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis (FontTableHashEntry *aEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { FontListSizes *sizes = static_cast(aUserArg); @@ -617,7 +618,7 @@ gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis } void -gfxFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFontEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf); @@ -634,7 +635,7 @@ gfxFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); @@ -1220,7 +1221,7 @@ gfxFontFamily::FindFont(const nsAString& aPostscriptName) } void -gfxFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFontFamily::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += @@ -1239,7 +1240,7 @@ gfxFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxFontFamily::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFontFamily::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); @@ -1498,7 +1499,7 @@ gfxFontCache::ClearCachedWordsForFont(HashEntry* aHashEntry, void* aUserData) /*static*/ size_t gfxFontCache::SizeOfFontEntryExcludingThis(HashEntry* aHashEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { HashEntry *entry = static_cast(aHashEntry); @@ -1511,7 +1512,7 @@ gfxFontCache::SizeOfFontEntryExcludingThis(HashEntry* aHashEntry, } void -gfxFontCache::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFontCache::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { // TODO: add the overhead of the expiration tracker (generation arrays) @@ -1521,7 +1522,7 @@ gfxFontCache::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxFontCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFontCache::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { aSizes->mFontInstances += aMallocSizeOf(this); @@ -3685,14 +3686,14 @@ gfxFont::SynthesizeSpaceWidth(uint32_t aCh) /*static*/ size_t gfxFont::WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { return aMallocSizeOf(aHashEntry->mShapedWord.get()); } void -gfxFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFont::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { for (uint32_t i = 0; i < mGlyphExtentsArray.Length(); ++i) { @@ -3705,7 +3706,7 @@ gfxFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxFont::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { aSizes->mFontInstances += aMallocSizeOf(this); @@ -3762,7 +3763,7 @@ gfxGlyphExtents::GlyphWidths::~GlyphWidths() } uint32_t -gfxGlyphExtents::GlyphWidths::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxGlyphExtents::GlyphWidths::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { uint32_t i; uint32_t size = mBlocks.SizeOfExcludingThis(aMallocSizeOf); @@ -3826,14 +3827,14 @@ gfxGlyphExtents::SetTightGlyphExtents(uint32_t aGlyphID, const gfxRect& aExtents } size_t -gfxGlyphExtents::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxGlyphExtents::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return mContainedGlyphWidths.SizeOfExcludingThis(aMallocSizeOf) + mTightGlyphExtents.SizeOfExcludingThis(nullptr, aMallocSizeOf); } size_t -gfxGlyphExtents::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxGlyphExtents::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } @@ -6564,7 +6565,7 @@ gfxTextRun::ClusterIterator::ClusterAdvance(PropertyProvider *aProvider) const } size_t -gfxTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) +gfxTextRun::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) { // The second arg is how much gfxTextRun::AllocateStorage would have // allocated. @@ -6578,7 +6579,7 @@ gfxTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) } size_t -gfxTextRun::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +gfxTextRun::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index cf5f567c5..88048cad7 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -25,6 +25,7 @@ #include "mozilla/HashFunctions.h" #include "nsIMemoryReporter.h" #include "gfxFontFeatures.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/gfx/Types.h" #include "mozilla/Attributes.h" #include @@ -196,7 +197,7 @@ public: void CalcHash() { mHash = GetChecksum(); } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return gfxSparseBitSet::SizeOfExcludingThis(aMallocSizeOf); } @@ -422,9 +423,9 @@ public: virtual void ReleaseGrFace(gr_face* aFace); // For memory reporting - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; nsString mName; @@ -636,7 +637,7 @@ private: static size_t SizeOfEntryExcludingThis(FontTableHashEntry *aEntry, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* aUserArg); private: @@ -797,9 +798,9 @@ public: void CheckForSimpleFamily(); // For memory reporter - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; // Only used for debugging checks - does a linear search @@ -965,9 +966,9 @@ public: mFonts.EnumerateEntries(ClearCachedWordsForFont, nullptr); } - void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; - void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; protected: @@ -1012,7 +1013,7 @@ protected: }; static size_t SizeOfFontEntryExcludingThis(HashEntry* aHashEntry, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* aUserArg); nsTHashtable mFonts; @@ -1186,8 +1187,8 @@ public: int32_t GetAppUnitsPerDevUnit() { return mAppUnitsPerDevUnit; } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: class HashEntry : public nsUint32HashKey { @@ -1224,7 +1225,7 @@ private: return widths[indexInBlock]; } - uint32_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + uint32_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; ~GlyphWidths(); @@ -1692,9 +1693,9 @@ public: } } - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; typedef enum { @@ -1902,7 +1903,7 @@ protected: static size_t WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* aUserArg); nsTHashtable mWordCache; @@ -2395,7 +2396,7 @@ protected: return details; } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) { + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { return aMallocSizeOf(this) + mDetails.SizeOfExcludingThis(aMallocSizeOf) + mOffsetToIndex.SizeOfExcludingThis(aMallocSizeOf); @@ -3153,13 +3154,13 @@ public: // return storage used by this run, for memory reporter; // nsTransformedTextRun needs to override this as it holds additional data - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) MOZ_MUST_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) MOZ_MUST_OVERRIDE; // Get the size, if it hasn't already been gotten, marking as it goes. - size_t MaybeSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) { + size_t MaybeSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { if (mFlags & gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED) { return 0; } diff --git a/gfx/thebes/gfxFontUtils.h b/gfx/thebes/gfxFontUtils.h index 3651f7796..e7de1cf9f 100644 --- a/gfx/thebes/gfxFontUtils.h +++ b/gfx/thebes/gfxFontUtils.h @@ -23,6 +23,7 @@ #include "nsAutoPtr.h" #include "mozilla/Likely.h" #include "mozilla/Endian.h" +#include "mozilla/MemoryReporting.h" #include "zlib.h" #include @@ -257,7 +258,7 @@ public: } } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t total = mBlocks.SizeOfExcludingThis(aMallocSizeOf); for (uint32_t i = 0; i < mBlocks.Length(); i++) { if (mBlocks[i]) { @@ -267,7 +268,7 @@ public: return total; } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index b78c5c40a..77f865547 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "gfxGDIFont.h" + +#include "mozilla/MemoryReporting.h" + #include "gfxGDIShaper.h" #include "gfxUniscribeShaper.h" #include "gfxHarfBuzzShaper.h" @@ -561,7 +564,7 @@ gfxGDIFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID) } void -gfxGDIFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxGDIFont::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -570,7 +573,7 @@ gfxGDIFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxGDIFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxGDIFont::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { aSizes->mFontInstances += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxGDIFont.h b/gfx/thebes/gfxGDIFont.h index 26f9a2e00..ea331c442 100644 --- a/gfx/thebes/gfxGDIFont.h +++ b/gfx/thebes/gfxGDIFont.h @@ -6,6 +6,7 @@ #ifndef GFX_GDIFONT_H #define GFX_GDIFONT_H +#include "mozilla/MemoryReporting.h" #include "gfxFont.h" #include "gfxGDIFontList.h" @@ -53,9 +54,9 @@ public: // get hinted glyph width in pixels as 16.16 fixed-point value virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID); - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; virtual FontType GetType() const { return FONT_TYPE_GDI; } diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 9762aaa56..dfaf81008 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -27,6 +27,8 @@ #include "nsISimpleEnumerator.h" #include "nsIWindowsRegKey.h" +#include "mozilla/MemoryReporting.h" + #include #include @@ -442,7 +444,7 @@ GDIFontEntry::CreateFontEntry(const nsAString& aName, } void -GDIFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +GDIFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); @@ -1062,7 +1064,7 @@ gfxGDIFontList::ResolveFontName(const nsAString& aFontName, nsAString& aResolved } void -gfxGDIFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxGDIFontList::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { gfxPlatformFontList::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -1078,7 +1080,7 @@ gfxGDIFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxGDIFontList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxGDIFontList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxGDIFontList.h b/gfx/thebes/gfxGDIFontList.h index af6f70d6b..5268d69a6 100644 --- a/gfx/thebes/gfxGDIFontList.h +++ b/gfx/thebes/gfxGDIFontList.h @@ -6,6 +6,7 @@ #ifndef GFX_GDIFONTLIST_H #define GFX_GDIFONTLIST_H +#include "mozilla/MemoryReporting.h" #include "gfxWindowsPlatform.h" #include "gfxPlatformFontList.h" #include "nsGkAtoms.h" @@ -239,7 +240,7 @@ public: virtual bool TestCharacterMap(uint32_t aCh); - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; // create a font entry for a font with a given name @@ -321,9 +322,9 @@ public: virtual bool ResolveFontName(const nsAString& aFontName, nsAString& aResolvedFontName); - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; private: diff --git a/gfx/thebes/gfxImageSurface.cpp b/gfx/thebes/gfxImageSurface.cpp index a1a27110e..d2e45b162 100644 --- a/gfx/thebes/gfxImageSurface.cpp +++ b/gfx/thebes/gfxImageSurface.cpp @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "mozilla/MemoryReporting.h" #include "gfxAlphaRecovery.h" #include "gfxImageSurface.h" @@ -197,7 +198,7 @@ gfxImageSurface::ComputeStride(const gfxIntSize& aSize, gfxImageFormat aFormat) } size_t -gfxImageSurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxImageSurface::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = gfxASurface::SizeOfExcludingThis(aMallocSizeOf); if (mOwnsData) { @@ -207,7 +208,7 @@ gfxImageSurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -gfxImageSurface::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +gfxImageSurface::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/gfx/thebes/gfxImageSurface.h b/gfx/thebes/gfxImageSurface.h index 16651535f..de1696f8d 100644 --- a/gfx/thebes/gfxImageSurface.h +++ b/gfx/thebes/gfxImageSurface.h @@ -6,6 +6,7 @@ #ifndef GFX_IMAGESURFACE_H #define GFX_IMAGESURFACE_H +#include "mozilla/MemoryReporting.h" #include "gfxASurface.h" #include "gfxPoint.h" @@ -113,9 +114,9 @@ public: static long ComputeStride(const gfxIntSize&, gfxImageFormat); - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; virtual bool SizeOfIsMeasured() const MOZ_OVERRIDE; diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 51f3e4c4b..80c863c67 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "gfxMacFont.h" + +#include "mozilla/MemoryReporting.h" + #include "gfxCoreTextShaper.h" #include "gfxHarfBuzzShaper.h" #include @@ -410,7 +413,7 @@ gfxMacFont::GetScaledFont(DrawTarget *aTarget) } void -gfxMacFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxMacFont::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); @@ -419,7 +422,7 @@ gfxMacFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxMacFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +gfxMacFont::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const { aSizes->mFontInstances += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxMacFont.h b/gfx/thebes/gfxMacFont.h index 4cc36668a..5d55be21d 100644 --- a/gfx/thebes/gfxMacFont.h +++ b/gfx/thebes/gfxMacFont.h @@ -6,6 +6,7 @@ #ifndef GFX_MACFONT_H #define GFX_MACFONT_H +#include "mozilla/MemoryReporting.h" #include "gfxFont.h" #include "gfxMacPlatformFontList.h" #include "mozilla/gfx/2D.h" @@ -42,9 +43,9 @@ public: virtual mozilla::TemporaryRef GetScaledFont(mozilla::gfx::DrawTarget *aTarget); - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontCacheSizes* aSizes) const; virtual FontType GetType() const { return FONT_TYPE_MAC; } diff --git a/gfx/thebes/gfxMacPlatformFontList.h b/gfx/thebes/gfxMacPlatformFontList.h index cd39de3b0..f3f7be7f7 100644 --- a/gfx/thebes/gfxMacPlatformFontList.h +++ b/gfx/thebes/gfxMacPlatformFontList.h @@ -6,6 +6,7 @@ #ifndef gfxMacPlatformFontList_H_ #define gfxMacPlatformFontList_H_ +#include "mozilla/MemoryReporting.h" #include "nsDataHashtable.h" #include "nsRefPtrHashtable.h" @@ -44,7 +45,7 @@ public: // use CGFontRef API to get direct access to system font data virtual hb_blob_t *GetFontTable(uint32_t aTag) MOZ_OVERRIDE; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; nsresult ReadCMAP(); diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index 385fc1e3a..ecae5024e 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -64,6 +64,7 @@ #include "nsISimpleEnumerator.h" #include "nsCharTraits.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include @@ -423,7 +424,7 @@ MacOSFontEntry::HasFontTable(uint32_t aTableTag) } void -MacOSFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +MacOSFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index 8b96c6d4a..0a715ccd4 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -16,6 +16,7 @@ #include "mozilla/Attributes.h" #include "mozilla/Likely.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/TimeStamp.h" @@ -748,7 +749,7 @@ gfxPlatformFontList::GetPrefsAndStartLoader() static size_t SizeOfFamilyEntryExcludingThis(const nsAString& aKey, const nsRefPtr& aFamily, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { FontListSizes *sizes = static_cast(aUserArg); @@ -766,7 +767,7 @@ SizeOfFamilyEntryExcludingThis(const nsAString& aKey, gfxPlatformFontList::SizeOfFamilyNameEntryExcludingThis (const nsAString& aKey, const nsRefPtr& aFamily, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { // we don't count the size of the family here, because this is an *extra* @@ -777,7 +778,7 @@ gfxPlatformFontList::SizeOfFamilyNameEntryExcludingThis static size_t SizeOfFontNameEntryExcludingThis(const nsAString& aKey, const nsRefPtr& aFont, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { // the font itself is counted by its owning family; here we only care about @@ -789,7 +790,7 @@ static size_t SizeOfPrefFontEntryExcludingThis (const uint32_t& aKey, const nsTArray >& aList, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { // again, we only care about the size of the array itself; we don't follow @@ -800,7 +801,7 @@ SizeOfPrefFontEntryExcludingThis static size_t SizeOfStringEntryExcludingThis(nsStringHashKey* aHashEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { return aHashEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf); @@ -808,7 +809,7 @@ SizeOfStringEntryExcludingThis(nsStringHashKey* aHashEntry, static size_t SizeOfSharedCmapExcludingThis(CharMapHashKey* aHashEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { FontListSizes *sizes = static_cast(aUserArg); @@ -822,8 +823,8 @@ SizeOfSharedCmapExcludingThis(CharMapHashKey* aHashEntry, } void -gfxPlatformFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, - FontListSizes* aSizes) const +gfxPlatformFontList::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, + FontListSizes* aSizes) const { aSizes->mFontListSize += mFontFamilies.SizeOfExcludingThis(SizeOfFamilyEntryExcludingThis, @@ -861,8 +862,8 @@ gfxPlatformFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, } void -gfxPlatformFontList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, - FontListSizes* aSizes) const +gfxPlatformFontList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, + FontListSizes* aSizes) const { aSizes->mFontListSize += aMallocSizeOf(this); SizeOfExcludingThis(aMallocSizeOf, aSizes); diff --git a/gfx/thebes/gfxPlatformFontList.h b/gfx/thebes/gfxPlatformFontList.h index 8364303f8..53c1c9474 100644 --- a/gfx/thebes/gfxPlatformFontList.h +++ b/gfx/thebes/gfxPlatformFontList.h @@ -16,6 +16,7 @@ #include "nsIMemoryReporter.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" class CharMapHashKey : public PLDHashEntryHdr { @@ -161,9 +162,9 @@ public: // (platforms may override, eg Mac) virtual bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName); - virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, FontListSizes* aSizes) const; // search for existing cmap that matches the input @@ -252,7 +253,7 @@ protected: static size_t SizeOfFamilyNameEntryExcludingThis(const nsAString& aKey, const nsRefPtr& aFamily, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* aUserArg); // canonical family name ==> family entry (unique, one name per family entry) diff --git a/image/src/FrameBlender.cpp b/image/src/FrameBlender.cpp index b1f642ff9..8dede54b4 100644 --- a/image/src/FrameBlender.cpp +++ b/image/src/FrameBlender.cpp @@ -5,6 +5,7 @@ #include "FrameBlender.h" +#include "mozilla/MemoryReporting.h" #include "RasterImage.h" #include "imgFrame.h" @@ -573,7 +574,7 @@ FrameBlender::Discard() size_t FrameBlender::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, - nsMallocSizeOfFun aMallocSizeOf) const + MallocSizeOf aMallocSizeOf) const { size_t n = 0; for (uint32_t i = 0; i < mFrames.Length(); ++i) { diff --git a/image/src/FrameBlender.h b/image/src/FrameBlender.h index ff2c89757..f94c18c26 100644 --- a/image/src/FrameBlender.h +++ b/image/src/FrameBlender.h @@ -8,6 +8,7 @@ #define mozilla_imagelib_FrameBlender_h_ #include "nsTArray.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "gfxASurface.h" @@ -57,7 +58,7 @@ public: void SetSize(nsIntSize aSize) { mSize = aSize; } size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, - nsMallocSizeOfFun aMallocSizeOf) const; + mozilla::MallocSizeOf aMallocSizeOf) const; void ResetAnimation(); diff --git a/image/src/Image.h b/image/src/Image.h index a020b713b..bdcba99d1 100644 --- a/image/src/Image.h +++ b/image/src/Image.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_IMAGELIB_IMAGE_H_ #define MOZILLA_IMAGELIB_IMAGE_H_ +#include "mozilla/MemoryReporting.h" #include "imgIContainer.h" #include "imgStatusTracker.h" #include "nsIURI.h" @@ -78,8 +79,8 @@ public: /** * The components that make up SizeOfData(). */ - virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const = 0; - virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const = 0; + virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0; + virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0; virtual size_t NonHeapSizeOfDecoded() const = 0; virtual size_t OutOfProcessSizeOfDecoded() const = 0; diff --git a/image/src/ImageWrapper.cpp b/image/src/ImageWrapper.cpp index 0d17bee77..e4a13dce0 100644 --- a/image/src/ImageWrapper.cpp +++ b/image/src/ImageWrapper.cpp @@ -4,6 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ImageWrapper.h" + +#include "mozilla/MemoryReporting.h" #include "Orientation.h" using mozilla::layers::LayerManager; @@ -39,13 +41,13 @@ ImageWrapper::SizeOfData() } size_t -ImageWrapper::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const +ImageWrapper::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const { return mInnerImage->HeapSizeOfSourceWithComputedFallback(aMallocSizeOf); } size_t -ImageWrapper::HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const +ImageWrapper::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const { return mInnerImage->HeapSizeOfDecodedWithComputedFallback(aMallocSizeOf); } diff --git a/image/src/ImageWrapper.h b/image/src/ImageWrapper.h index 068de35d7..4283d4f99 100644 --- a/image/src/ImageWrapper.h +++ b/image/src/ImageWrapper.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_IMAGELIB_IMAGEWRAPPER_H_ #define MOZILLA_IMAGELIB_IMAGEWRAPPER_H_ +#include "mozilla/MemoryReporting.h" #include "Image.h" namespace mozilla { @@ -29,8 +30,8 @@ public: virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE; virtual uint32_t SizeOfData() MOZ_OVERRIDE; - virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; - virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE; virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE; diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index a99da693f..290817200 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -39,6 +39,7 @@ #include "gfxContext.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Services.h" #include "mozilla/Preferences.h" #include "mozilla/StandardInteger.h" @@ -1192,7 +1193,7 @@ RasterImage::UpdateImageContainer() } size_t -RasterImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const +RasterImage::HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const { // n == 0 is possible for two reasons. // - This is a zero-length image. @@ -1207,7 +1208,7 @@ RasterImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeO size_t RasterImage::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, - nsMallocSizeOfFun aMallocSizeOf) const + MallocSizeOf aMallocSizeOf) const { size_t n = mFrameBlender.SizeOfDecodedWithComputedFallbackIfHeap(aLocation, aMallocSizeOf); @@ -1219,7 +1220,7 @@ RasterImage::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation } size_t -RasterImage::HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const +RasterImage::HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const { return SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MEMORY_IN_PROCESS_HEAP, aMallocSizeOf); diff --git a/image/src/RasterImage.h b/image/src/RasterImage.h index ece86727c..fd3ba1552 100644 --- a/image/src/RasterImage.h +++ b/image/src/RasterImage.h @@ -31,6 +31,7 @@ #include "DiscardTracker.h" #include "Orientation.h" #include "nsISupportsImpl.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/LinkedList.h" #include "mozilla/Mutex.h" #include "mozilla/ReentrantMonitor.h" @@ -180,8 +181,8 @@ public: /* The total number of frames in this image. */ uint32_t GetNumFrames() const; - virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const; virtual size_t NonHeapSizeOfDecoded() const; virtual size_t OutOfProcessSizeOfDecoded() const; @@ -594,7 +595,7 @@ private: mozilla::TimeStamp GetCurrentImgFrameEndTime() const; size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, - nsMallocSizeOfFun aMallocSizeOf) const; + mozilla::MallocSizeOf aMallocSizeOf) const; inline void EnsureAnimExists() { diff --git a/image/src/VectorImage.cpp b/image/src/VectorImage.cpp index 8b0db9701..ff041184a 100644 --- a/image/src/VectorImage.cpp +++ b/image/src/VectorImage.cpp @@ -13,6 +13,7 @@ #include "gfxUtils.h" #include "imgDecoderObserver.h" #include "mozilla/AutoRestore.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/SVGSVGElement.h" #include "nsComponentManagerUtils.h" #include "nsIObserverService.h" @@ -346,7 +347,7 @@ VectorImage::FrameRect(uint32_t aWhichFrame) } size_t -VectorImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const +VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const { // We're not storing the source data -- we just feed that directly to // our helper SVG document as we receive it, for it to parse. @@ -355,7 +356,7 @@ VectorImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeO } size_t -VectorImage::HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const +VectorImage::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const { // XXXdholbert TODO: return num bytes used by helper SVG doc. (bug 590790) return 0; diff --git a/image/src/VectorImage.h b/image/src/VectorImage.h index 80746ddf9..fbc21ba08 100644 --- a/image/src/VectorImage.h +++ b/image/src/VectorImage.h @@ -9,6 +9,7 @@ #include "Image.h" #include "nsIStreamListener.h" #include "nsIRequest.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "mozilla/WeakPtr.h" @@ -43,8 +44,8 @@ public: uint32_t aFlags); virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE; - virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const; virtual size_t NonHeapSizeOfDecoded() const; virtual size_t OutOfProcessSizeOfDecoded() const; diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index 21120bdad..38da67aee 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -20,6 +20,7 @@ static bool gDisableOptimize = false; #include "GoannaProfiler.h" #include "mozilla/Likely.h" #include "mozilla/CheckedInt.h" +#include "mozilla/MemoryReporting.h" #if defined(XP_WIN) @@ -798,7 +799,7 @@ void imgFrame::SetCompositingFailed(bool val) // |aMallocSizeOf|. If that fails (because the platform doesn't support it) or // it's non-heap memory, we fall back to computing the size analytically. size_t -imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, nsMallocSizeOfFun aMallocSizeOf) const +imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, mozilla::MallocSizeOf aMallocSizeOf) const { // aMallocSizeOf is only used if aLocation==MEMORY_IN_PROCESS_HEAP. It // should be NULL otherwise. diff --git a/image/src/imgFrame.h b/image/src/imgFrame.h index 440aa33ce..b667c4d38 100644 --- a/image/src/imgFrame.h +++ b/image/src/imgFrame.h @@ -7,6 +7,7 @@ #ifndef imgFrame_h #define imgFrame_h +#include "mozilla/MemoryReporting.h" #include "nsRect.h" #include "nsPoint.h" #include "nsSize.h" @@ -104,7 +105,7 @@ public: size_t SizeOfExcludingThisWithComputedFallbackIfHeap( gfxASurface::MemoryLocation aLocation, - nsMallocSizeOfFun aMallocSizeOf) const; + mozilla::MallocSizeOf aMallocSizeOf) const; uint8_t GetPaletteDepth() const { return mPaletteDepth; } uint32_t PaletteDataLength() const { diff --git a/ipc/chromium/src/base/histogram.cc b/ipc/chromium/src/base/histogram.cc index 819d90177..57581a2dc 100644 --- a/ipc/chromium/src/base/histogram.cc +++ b/ipc/chromium/src/base/histogram.cc @@ -409,7 +409,7 @@ bool Histogram::HasValidRangeChecksum() const { return CalculateRangeChecksum() == range_checksum_; } -size_t Histogram::SizeOfIncludingThis(size_t (*aMallocSizeOf)(const void*)) +size_t Histogram::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { size_t n = 0; n += aMallocSizeOf(this); @@ -420,7 +420,7 @@ size_t Histogram::SizeOfIncludingThis(size_t (*aMallocSizeOf)(const void*)) return n; } -size_t Histogram::SampleSet::SizeOfExcludingThis(size_t (*aMallocSizeOf)(const void*)) +size_t Histogram::SampleSet::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) { // We're not allowed to do deep dives into STL data structures. This // is as close as we can get to measuring this array. diff --git a/ipc/chromium/src/base/histogram.h b/ipc/chromium/src/base/histogram.h index 960984ec5..b316094fa 100644 --- a/ipc/chromium/src/base/histogram.h +++ b/ipc/chromium/src/base/histogram.h @@ -41,6 +41,8 @@ #define BASE_METRICS_HISTOGRAM_H_ #pragma once +#include "mozilla/MemoryReporting.h" + #include #include #include @@ -316,10 +318,7 @@ class Histogram { const char* description; // Null means end of a list of pairs. }; - // To avoid depending on XPCOM headers, we define our own MallocSizeOf type. - typedef size_t (*MallocSizeOf)(const void*); - - size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); //---------------------------------------------------------------------------- // Statistic values, developed over the life of the histogram. @@ -357,7 +356,7 @@ class Histogram { bool Serialize(Pickle* pickle) const; bool Deserialize(void** iter, const Pickle& pickle); - size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf); + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf); protected: // Actual histogram data is stored in buckets, showing the count of values diff --git a/js/public/HashTable.h b/js/public/HashTable.h index b9b7ef8a3..5bd772b8a 100644 --- a/js/public/HashTable.h +++ b/js/public/HashTable.h @@ -11,6 +11,7 @@ #include "mozilla/Attributes.h" #include "mozilla/Casting.h" #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "mozilla/TypeTraits.h" #include "mozilla/Util.h" @@ -204,10 +205,10 @@ class HashMap // Don't just call |impl.sizeOfExcludingThis()| because there's no // guarantee that |impl| is the first field in HashMap. - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return impl.sizeOfExcludingThis(mallocSizeOf); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf); } @@ -412,10 +413,10 @@ class HashSet // Don't just call |impl.sizeOfExcludingThis()| because there's no // guarantee that |impl| is the first field in HashSet. - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return impl.sizeOfExcludingThis(mallocSizeOf); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf); } @@ -1340,12 +1341,12 @@ class HashTable : private AllocPolicy return gen; } - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(table); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 7fdf0d39d..848a1f46f 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -10,6 +10,8 @@ // These declarations are not within jsapi.h because they are highly likely to // change in the future. Depend on them at your own risk. +#include "mozilla/MemoryReporting.h" + #include #include "jsalloc.h" @@ -363,7 +365,7 @@ struct CompartmentStats struct RuntimeStats { - RuntimeStats(JSMallocSizeOfFun mallocSizeOf) + RuntimeStats(mozilla::MallocSizeOf mallocSizeOf) : runtime(), gcHeapChunkTotal(0), gcHeapDecommittedArenas(0), @@ -420,7 +422,7 @@ struct RuntimeStats ZoneStats *currZoneStats; - JSMallocSizeOfFun mallocSizeOf_; + mozilla::MallocSizeOf mallocSizeOf_; virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentStats *cstats) = 0; virtual void initExtraZoneStats(JS::Zone *zone, ZoneStats *zstats) = 0; diff --git a/js/public/Utility.h b/js/public/Utility.h index 8fd3943a6..9dce6d9d8 100644 --- a/js/public/Utility.h +++ b/js/public/Utility.h @@ -818,11 +818,6 @@ inline bool IsPoisonedPtr(T *v) } -/* - * This is SpiderMonkey's equivalent to |nsMallocSizeOfFun|. - */ -typedef size_t(*JSMallocSizeOfFun)(const void *p); - /* sixgill annotation defines */ #ifndef HAVE_STATIC_ANNOTATIONS # define HAVE_STATIC_ANNOTATIONS diff --git a/js/public/Vector.h b/js/public/Vector.h index e807028c1..13c9f5ae2 100644 --- a/js/public/Vector.h +++ b/js/public/Vector.h @@ -8,6 +8,7 @@ #define js_Vector_h #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TypeTraits.h" #include "TemplateLib.h" @@ -504,13 +505,13 @@ class Vector : private AllocPolicy /* * Measure the size of the Vector's heap-allocated storage. */ - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const; + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const; /* * Like sizeOfExcludingThis, but also measures the size of the Vector * object (which must be heap-allocated) itself. */ - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const; + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; void swap(Vector &other); }; @@ -1070,14 +1071,14 @@ Vector::replaceRawBuffer(T *p, size_t aLength) template inline size_t -Vector::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const +Vector::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck()); } template inline size_t -Vector::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const +Vector::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 61db3460f..3946a8237 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -7,6 +7,7 @@ #include "ctypes/CTypes.h" #include "mozilla/FloatingPoint.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/StandardInteger.h" #include @@ -1337,7 +1338,7 @@ JS_SetCTypesCallbacks(JSObject *ctypesObj, JSCTypesCallbacks* callbacks) namespace js { JS_FRIEND_API(size_t) -SizeOfDataIfCDataObject(JSMallocSizeOfFun mallocSizeOf, JSObject *obj) +SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj) { if (!CData::IsCData(obj)) return 0; diff --git a/js/src/ds/LifoAlloc.h b/js/src/ds/LifoAlloc.h index 3e663e4f2..7ea2b3146 100644 --- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -9,6 +9,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/MemoryChecking.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "mozilla/TypeTraits.h" @@ -89,7 +90,7 @@ class BumpChunk size_t used() const { return bump - bumpBase(); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(this); } @@ -346,7 +347,7 @@ class LifoAlloc } // Get the total size of the arena chunks (including unused space). - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { size_t n = 0; for (BumpChunk *chunk = first; chunk; chunk = chunk->next()) n += chunk->sizeOfIncludingThis(mallocSizeOf); @@ -354,7 +355,7 @@ class LifoAlloc } // Like sizeOfExcludingThis(), but includes the size of the LifoAlloc itself. - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index adb808d30..aa5cd8dfa 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -9,6 +9,7 @@ #include "mozilla/Attributes.h" #include "mozilla/GuardObjects.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "jscntxt.h" @@ -260,7 +261,7 @@ struct Zone : private JS::shadow::Zone, void discardJitCode(js::FreeOp *fop, bool discardConstraints); - void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *typePool); + void sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t *typePool); void setGCLastBytes(size_t lastBytes, js::JSGCInvocationKind gckind); void reduceGCTriggerBytes(size_t amount); diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index b3832f08a..633617082 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -4,6 +4,8 @@ * 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/MemoryReporting.h" + #include "BaselineCompiler.h" #include "BaselineIC.h" #include "BaselineJIT.h" @@ -854,7 +856,7 @@ jit::IonCompartment::toggleBaselineStubBarriers(bool enabled) } void -jit::SizeOfBaselineData(JSScript *script, JSMallocSizeOfFun mallocSizeOf, size_t *data, +jit::SizeOfBaselineData(JSScript *script, mozilla::MallocSizeOf mallocSizeOf, size_t *data, size_t *fallbackStubs) { *data = 0; diff --git a/js/src/jit/BaselineJIT.h b/js/src/jit/BaselineJIT.h index c3f998161..a6b7a7bdd 100644 --- a/js/src/jit/BaselineJIT.h +++ b/js/src/jit/BaselineJIT.h @@ -9,6 +9,8 @@ #ifdef JS_ION +#include "mozilla/MemoryReporting.h" + #include "jscntxt.h" #include "jscompartment.h" @@ -157,7 +159,7 @@ struct BaselineScript return offsetof(BaselineScript, method_); } - void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *data, + void sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t *data, size_t *fallbackStubs) const { *data = mallocSizeOf(this); @@ -280,7 +282,7 @@ void FinishDiscardBaselineScript(FreeOp *fop, JSScript *script); void -SizeOfBaselineData(JSScript *script, JSMallocSizeOfFun mallocSizeOf, size_t *data, +SizeOfBaselineData(JSScript *script, mozilla::MallocSizeOf mallocSizeOf, size_t *data, size_t *fallbackStubs); void diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index 83cdb279d..11f7aa910 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -4,6 +4,8 @@ * 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/MemoryReporting.h" + #include "BaselineJIT.h" #include "BaselineCompiler.h" #include "BaselineInspector.h" @@ -2405,7 +2407,7 @@ jit::PurgeCaches(JSScript *script, Zone *zone) } size_t -jit::SizeOfIonData(JSScript *script, JSMallocSizeOfFun mallocSizeOf) +jit::SizeOfIonData(JSScript *script, mozilla::MallocSizeOf mallocSizeOf) { size_t result = 0; diff --git a/js/src/jit/Ion.h b/js/src/jit/Ion.h index 4bae18b1d..e54e79649 100644 --- a/js/src/jit/Ion.h +++ b/js/src/jit/Ion.h @@ -9,6 +9,8 @@ #ifdef JS_ION +#include "mozilla/MemoryReporting.h" + #include "jscntxt.h" #include "jscompartment.h" #include "IonCode.h" @@ -349,7 +351,7 @@ void ForbidCompilation(JSContext *cx, JSScript *script, ExecutionMode mode); uint32_t UsesBeforeIonRecompile(JSScript *script, jsbytecode *pc); void PurgeCaches(JSScript *script, JS::Zone *zone); -size_t SizeOfIonData(JSScript *script, JSMallocSizeOfFun mallocSizeOf); +size_t SizeOfIonData(JSScript *script, mozilla::MallocSizeOf mallocSizeOf); void DestroyIonScripts(FreeOp *fop, JSScript *script); void TraceIonScripts(JSTracer* trc, JSScript *script); diff --git a/js/src/jit/IonCode.h b/js/src/jit/IonCode.h index 3b2447631..19d009363 100644 --- a/js/src/jit/IonCode.h +++ b/js/src/jit/IonCode.h @@ -7,6 +7,7 @@ #ifndef jit_IonCode_h #define jit_IonCode_h +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "IonTypes.h" @@ -435,7 +436,7 @@ struct IonScript size_t callTargetEntries() const { return callTargetEntries_; } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this); } EncapsulatedValue &getConstant(size_t index) { diff --git a/js/src/jit/IonCompartment.h b/js/src/jit/IonCompartment.h index 88107ed0d..9b392b0f3 100644 --- a/js/src/jit/IonCompartment.h +++ b/js/src/jit/IonCompartment.h @@ -9,6 +9,8 @@ #ifdef JS_ION +#include "mozilla/MemoryReporting.h" + #include "IonCode.h" #include "jsweakcache.h" #include "js/Value.h" @@ -80,7 +82,7 @@ struct ICStubSpace JS_DECLARE_NEW_METHODS(allocate, alloc, inline) - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return allocator_.sizeOfExcludingThis(mallocSizeOf); } }; diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 84e4e1192..72e61d347 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -10,6 +10,7 @@ #define jsapi_h #include "mozilla/FloatingPoint.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/RangedPtr.h" #include "mozilla/StandardInteger.h" #include "mozilla/ThreadLocal.h" @@ -379,10 +380,10 @@ class AutoHashMapRooter : protected AutoGCRooter return map.capacity(); } - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return map.sizeOfExcludingThis(mallocSizeOf); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return map.sizeOfIncludingThis(mallocSizeOf); } @@ -494,10 +495,10 @@ class AutoHashSetRooter : protected AutoGCRooter return set.capacity(); } - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return set.sizeOfExcludingThis(mallocSizeOf); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return set.sizeOfIncludingThis(mallocSizeOf); } diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index f11654084..c4c8354a9 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -22,6 +22,7 @@ # include #endif // ANDROID +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "jstypes.h" @@ -112,7 +113,7 @@ NewObjectCache::clearNurseryObjects(JSRuntime *rt) } void -JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes *rtSizes) +JSRuntime::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::RuntimeSizes *rtSizes) { rtSizes->object = mallocSizeOf(this); @@ -1489,7 +1490,7 @@ JSContext::updateJITEnabled() } size_t -JSContext::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const +JSContext::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { /* * There are other JSContext members that could be measured; the following diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index b7aa4b83a..c27599d87 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -10,6 +10,7 @@ #define jscntxt_h #include "mozilla/LinkedList.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include @@ -1473,7 +1474,7 @@ struct JSRuntime : public JS::shadow::Runtime, return jitHardening; } - void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes *runtime); + void sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::RuntimeSizes *runtime); private: @@ -1920,7 +1921,7 @@ struct JSContext : js::ThreadSafeContext, */ bool runningWithTrustedPrincipals() const; - JS_FRIEND_API(size_t) sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const; + JS_FRIEND_API(size_t) sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; void mark(JSTracer *trc); diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index 2e662530f..d1a2f2939 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -7,6 +7,7 @@ #include "jscompartment.h" #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "jscntxt.h" #include "jsgc.h" @@ -827,7 +828,7 @@ JSCompartment::clearTraps(FreeOp *fop) } void -JSCompartment::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *compartmentObject, +JSCompartment::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t *compartmentObject, JS::TypeInferenceSizes *tiSizes, size_t *shapesCompartmentTables, size_t *crossCompartmentWrappersArg, size_t *regexpCompartment, size_t *debuggeesSet, size_t *baselineStubsOptimized) diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index 1ef2ed8fd..fb43a750e 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -7,6 +7,7 @@ #ifndef jscompartment_h #define jscompartment_h +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "jscntxt.h" @@ -195,10 +196,10 @@ struct JSCompartment js::RegExpCompartment regExps; private: - void sizeOfTypeInferenceData(JS::TypeInferenceSizes *stats, JSMallocSizeOfFun mallocSizeOf); + void sizeOfTypeInferenceData(JS::TypeInferenceSizes *stats, mozilla::MallocSizeOf mallocSizeOf); public: - void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *compartmentObject, + void sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t *compartmentObject, JS::TypeInferenceSizes *tiSizes, size_t *shapesCompartmentTables, size_t *crossCompartmentWrappers, size_t *regexpCompartment, size_t *debuggeesSet, diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index b7aab86d7..788be2d66 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -7,6 +7,7 @@ #ifndef jsfriendapi_h #define jsfriendapi_h +#include "mozilla/MemoryReporting.h" #include "mozilla/Casting.h" #include "jsclass.h" @@ -322,7 +323,7 @@ IterateGrayObjects(JS::Zone *zone, GCThingCallback cellCallback, void *data); #ifdef JS_HAS_CTYPES extern JS_FRIEND_API(size_t) -SizeOfDataIfCDataObject(JSMallocSizeOfFun mallocSizeOf, JSObject *obj); +SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj); #endif extern JS_FRIEND_API(JSCompartment *) diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 0db550f02..9d45e19a4 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -11,6 +11,7 @@ #include "prmjtime.h" #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" /* @@ -1865,7 +1866,7 @@ GCMarker::GrayCallback(JSTracer *trc, void **thingp, JSGCTraceKind kind) } size_t -GCMarker::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const +GCMarker::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { size_t size = stack.sizeOfExcludingThis(mallocSizeOf); for (ZonesIter zone(runtime); !zone.done(); zone.next()) diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 4bf5c2fb4..d1bbe4faa 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -10,6 +10,7 @@ #define jsgc_h #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "jsalloc.h" @@ -919,7 +920,7 @@ struct MarkStack { return true; } - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { size_t n = 0; if (stack != ballast) n += mallocSizeOf(stack); @@ -1089,7 +1090,7 @@ struct GCMarker : public JSTracer { static void GrayCallback(JSTracer *trc, void **thing, JSGCTraceKind kind); - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const; + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const; MarkStack stack; diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 5519e65c6..9bd3dbe1d 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -7,6 +7,7 @@ #include "jsinfer.h" #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "jsapi.h" @@ -6725,7 +6726,7 @@ TypeCompartment::maybePurgeAnalysis(JSContext *cx, bool force) static void SizeOfScriptTypeInferenceData(JSScript *script, JS::TypeInferenceSizes *sizes, - JSMallocSizeOfFun mallocSizeOf) + mozilla::MallocSizeOf mallocSizeOf) { TypeScript *typeScript = script->types; if (!typeScript) @@ -6747,13 +6748,13 @@ SizeOfScriptTypeInferenceData(JSScript *script, JS::TypeInferenceSizes *sizes, } void -Zone::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *typePool) +Zone::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t *typePool) { *typePool += types.typeLifoAlloc.sizeOfExcludingThis(mallocSizeOf); } void -JSCompartment::sizeOfTypeInferenceData(JS::TypeInferenceSizes *sizes, JSMallocSizeOfFun mallocSizeOf) +JSCompartment::sizeOfTypeInferenceData(JS::TypeInferenceSizes *sizes, mozilla::MallocSizeOf mallocSizeOf) { sizes->analysisPool += analysisLifoAlloc.sizeOfExcludingThis(mallocSizeOf); @@ -6792,7 +6793,7 @@ JSCompartment::sizeOfTypeInferenceData(JS::TypeInferenceSizes *sizes, JSMallocSi } size_t -TypeObject::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) +TypeObject::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) { if (singleton) { /* diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index 98c614ba4..f04fda135 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -9,6 +9,8 @@ #ifndef jsinfer_h #define jsinfer_h +#include "mozilla/MemoryReporting.h" + #include "jsalloc.h" #include "jsfriendapi.h" @@ -1089,7 +1091,7 @@ struct TypeObject : gc::Cell inline void clearProperties(); inline void sweep(FreeOp *fop); - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf); + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf); /* * Type objects don't have explicit finalizers. Memory owned by a type diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 73945d6f0..18f088c43 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -8,6 +8,7 @@ #include "jsiter.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "mozilla/Util.h" @@ -813,7 +814,7 @@ iterator_iteratorObject(JSContext *cx, HandleObject obj, JSBool keysonly) } size_t -PropertyIteratorObject::sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const +PropertyIteratorObject::sizeOfMisc(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(getPrivate()); } diff --git a/js/src/jsiter.h b/js/src/jsiter.h index 9844760c4..d95765a6d 100644 --- a/js/src/jsiter.h +++ b/js/src/jsiter.h @@ -10,6 +10,9 @@ /* * JavaScript iterators. */ + +#include "mozilla/MemoryReporting.h" + #include "jscntxt.h" #include "gc/Barrier.h" @@ -119,7 +122,7 @@ class PropertyIteratorObject : public JSObject inline NativeIterator *getNativeIterator() const; inline void setNativeIterator(js::NativeIterator *ni); - size_t sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const; + size_t sizeOfMisc(mozilla::MallocSizeOf mallocSizeOf) const; private: static void trace(JSTracer *trc, JSObject *obj); diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 0ae4b5fa0..b93da94fd 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -20,6 +20,7 @@ #include "mozilla/Constants.h" #include "mozilla/FloatingPoint.h" #include "mozilla/MathAlgorithms.h" +#include "mozilla/MemoryReporting.h" #include // for std::max #include @@ -97,7 +98,7 @@ MathCache::MathCache() { } size_t -MathCache::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) +MathCache::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(this); } diff --git a/js/src/jsmath.h b/js/src/jsmath.h index 3be956727..9be6c2223 100644 --- a/js/src/jsmath.h +++ b/js/src/jsmath.h @@ -7,6 +7,8 @@ #ifndef jsmath_h #define jsmath_h +#include "mozilla/MemoryReporting.h" + #include "jsapi.h" namespace js { @@ -44,7 +46,7 @@ class MathCache return (e.out = f(x)); } - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf); + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); }; } /* namespace js */ diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index e59893f91..4bd3cb4c9 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -11,6 +11,7 @@ #include +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "jstypes.h" @@ -5424,7 +5425,7 @@ js_DumpBacktrace(JSContext *cx) fprintf(stdout, "%s", sprinter.string()); } void -JSObject::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, JS::ObjectsExtraSizes *sizes) +JSObject::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ObjectsExtraSizes *sizes) { if (hasDynamicSlots()) sizes->slots = mallocSizeOf(slots); diff --git a/js/src/jsobj.h b/js/src/jsobj.h index cd830c917..3eacd2dc8 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -15,6 +15,9 @@ * values, called slots. The map/slot pointer pair is GC'ed, while the map * is reference counted and the slot vector is malloc'ed. */ + +#include "mozilla/MemoryReporting.h" + #include "jsapi.h" #include "jsatom.h" #include "jsclass.h" @@ -319,7 +322,7 @@ class JSObject : public js::ObjectImpl inline bool hasShapeTable() const; - void sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, JS::ObjectsExtraSizes *sizes); + void sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ObjectsExtraSizes *sizes); bool hasIdempotentProtoChain() const; diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 9d625c46f..c86c258dd 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -12,6 +12,7 @@ #include +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "jstypes.h" @@ -1356,7 +1357,7 @@ ScriptSource::destroy() } size_t -ScriptSource::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) +ScriptSource::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { // |data| is a union, but both members are pointers to allocated memory, // |emptySource|, or NULL, so just using |data.compressed| will work. @@ -1953,7 +1954,7 @@ JSScript::computedSizeOfData() } size_t -JSScript::sizeOfData(JSMallocSizeOfFun mallocSizeOf) +JSScript::sizeOfData(mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(data); } diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 9b4c5c185..2f8862911 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -9,6 +9,7 @@ #ifndef jsscript_h #define jsscript_h +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "jsdbgapi.h" @@ -346,7 +347,7 @@ struct ScriptSource } const jschar *chars(JSContext *cx); JSStableString *substring(JSContext *cx, uint32_t start, uint32_t stop); - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf); + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); // XDR handling template @@ -843,7 +844,7 @@ class JSScript : public js::gc::Cell * (which can be larger than the in-use size). */ size_t computedSizeOfData(); - size_t sizeOfData(JSMallocSizeOfFun mallocSizeOf); + size_t sizeOfData(mozilla::MallocSizeOf mallocSizeOf); uint32_t numNotes(); /* Number of srcnote slots in the srcnotes section */ @@ -1255,7 +1256,7 @@ class LazyScript : public js::gc::Cell void markChildren(JSTracer *trc); void finalize(js::FreeOp *fop); - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(table_); } diff --git a/js/src/vm/ArgumentsObject-inl.h b/js/src/vm/ArgumentsObject-inl.h index fefefc876..a95694617 100644 --- a/js/src/vm/ArgumentsObject-inl.h +++ b/js/src/vm/ArgumentsObject-inl.h @@ -9,6 +9,8 @@ #include "vm/ArgumentsObject.h" +#include "mozilla/MemoryReporting.h" + #include "vm/ScopeObject.h" namespace js { @@ -142,7 +144,7 @@ ArgumentsObject::maybeGetElements(uint32_t start, uint32_t count, Value *vp) } inline size_t -ArgumentsObject::sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const +ArgumentsObject::sizeOfMisc(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(data()); } diff --git a/js/src/vm/ArgumentsObject.h b/js/src/vm/ArgumentsObject.h index 4d353d2e7..f31cc6c85 100644 --- a/js/src/vm/ArgumentsObject.h +++ b/js/src/vm/ArgumentsObject.h @@ -7,6 +7,8 @@ #ifndef vm_ArgumentsObject_h #define vm_ArgumentsObject_h +#include "mozilla/MemoryReporting.h" + #include "jsfun.h" namespace js { @@ -203,7 +205,7 @@ class ArgumentsObject : public JSObject * Measures things hanging off this ArgumentsObject that are counted by the * |miscSize| argument in JSObject::sizeOfExcludingThis(). */ - inline size_t sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const; + inline size_t sizeOfMisc(mozilla::MallocSizeOf mallocSizeOf) const; static void finalize(FreeOp *fop, JSObject *obj); static void trace(JSTracer *trc, JSObject *obj); diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 97a6f1e40..070884510 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -6,6 +6,8 @@ #include "vm/RegExpObject.h" +#include "mozilla/MemoryReporting.h" + #include "jsstr.h" #include "frontend/TokenStream.h" @@ -757,7 +759,7 @@ RegExpCompartment::get(JSContext *cx, HandleAtom atom, JSString *opt, RegExpGuar } size_t -RegExpCompartment::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) +RegExpCompartment::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = 0; n += map_.sizeOfExcludingThis(mallocSizeOf); diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h index fa8438035..001959c12 100644 --- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -8,6 +8,7 @@ #define vm_RegExpObject_h #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include #include "jscntxt.h" @@ -284,7 +285,7 @@ class RegExpCompartment /* Like 'get', but compile 'maybeOpt' (if non-null). */ bool get(JSContext *cx, HandleAtom source, JSString *maybeOpt, RegExpGuard *g); - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf); + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf); }; class RegExpObject : public JSObject diff --git a/js/src/vm/RegExpStatics-inl.h b/js/src/vm/RegExpStatics-inl.h index f4af01e0c..66fbe03f7 100644 --- a/js/src/vm/RegExpStatics-inl.h +++ b/js/src/vm/RegExpStatics-inl.h @@ -7,6 +7,8 @@ #ifndef vm_RegExpStatics_inl_h #define vm_RegExpStatics_inl_h +#include "mozilla/MemoryReporting.h" + #include "vm/RegExpStatics.h" #include "gc/Marking.h" @@ -211,7 +213,7 @@ js::GlobalObject::getRegExpStatics() const } inline size_t -SizeOfRegExpStaticsData(const JSObject *obj, JSMallocSizeOfFun mallocSizeOf) +SizeOfRegExpStaticsData(const JSObject *obj, mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(obj->getPrivate()); } diff --git a/js/src/vm/RegExpStatics.h b/js/src/vm/RegExpStatics.h index 4778d00a1..491972bf9 100644 --- a/js/src/vm/RegExpStatics.h +++ b/js/src/vm/RegExpStatics.h @@ -7,6 +7,8 @@ #ifndef vm_RegExpStatics_h #define vm_RegExpStatics_h +#include "mozilla/MemoryReporting.h" + #include #include "jspubtd.h" @@ -18,7 +20,7 @@ namespace js { class PreserveRegExpStatics; class RegExpStatics; -size_t SizeOfRegExpStaticsData(const JSObject *obj, JSMallocSizeOfFun mallocSizeOf); +size_t SizeOfRegExpStaticsData(const JSObject *obj, mozilla::MallocSizeOf mallocSizeOf); } /* namespace js */ diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index d1f5ed9fb..71d12dcb3 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -9,6 +9,7 @@ #include "mozilla/Attributes.h" #include "mozilla/GuardObjects.h" +#include "mozilla/MemoryReporting.h" #include "jsobj.h" #include "jspropertytree.h" @@ -144,7 +145,7 @@ struct ShapeTable { * This counts the ShapeTable object itself (which must be * heap-allocated) and its |entries| array. */ - size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + mallocSizeOf(entries); } @@ -548,7 +549,7 @@ class Shape : public js::gc::Cell bool hasTable() const { return base()->hasTable(); } ShapeTable &table() const { return base()->table(); } - void sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, + void sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, size_t *propTableSize, size_t *kidsSize) const { *propTableSize = hasTable() ? table().sizeOfIncludingThis(mallocSizeOf) : 0; *kidsSize = !inDictionary() && kids.isHash() diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index fffcf733c..d9aff7c8f 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -7,6 +7,8 @@ #ifndef vm_Stack_h #define vm_Stack_h +#include "mozilla/MemoryReporting.h" + #include "jsautooplen.h" #include "jsfun.h" #include "jsscript.h" @@ -1075,7 +1077,7 @@ class InterpreterStack inline void purge(JSRuntime *rt); - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return allocator_.sizeOfExcludingThis(mallocSizeOf); } }; diff --git a/js/src/vm/String.cpp b/js/src/vm/String.cpp index 8d889b41d..43fafb64a 100644 --- a/js/src/vm/String.cpp +++ b/js/src/vm/String.cpp @@ -6,6 +6,7 @@ #include "vm/String.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "mozilla/RangedPtr.h" @@ -40,7 +41,7 @@ JSString::isExternal() const } size_t -JSString::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) +JSString::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) { // JSRope: do nothing, we'll count all children chars when we hit the leaf strings. if (isRope()) diff --git a/js/src/vm/String.h b/js/src/vm/String.h index 1e29fbfb6..b6823605d 100644 --- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -7,6 +7,7 @@ #ifndef vm_String_h #define vm_String_h +#include "mozilla/MemoryReporting.h" #include "mozilla/PodOperations.h" #include "jsapi.h" @@ -396,7 +397,7 @@ class JSString : public js::gc::Cell /* Gets the number of bytes that the chars take on the heap. */ - size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf); + size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf); /* Offsets for direct field from jit code. */ diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 628bd5f62..09c9190cb 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -6,6 +6,7 @@ /* Per JSRuntime object */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "xpcprivate.h" @@ -1121,7 +1122,7 @@ XPCJSRuntime::CTypesActivityCallback(JSContext *cx, js::CTypesActivityType type) } size_t -XPCJSRuntime::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +XPCJSRuntime::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); diff --git a/js/xpconnect/src/XPCMaps.cpp b/js/xpconnect/src/XPCMaps.cpp index 963c9960e..2fe53f177 100644 --- a/js/xpconnect/src/XPCMaps.cpp +++ b/js/xpconnect/src/XPCMaps.cpp @@ -6,6 +6,7 @@ /* Private maps (hashtables). */ +#include "mozilla/MemoryReporting.h" #include "xpcprivate.h" #include "js/HashTable.h" @@ -138,7 +139,7 @@ Native2WrappedNativeMap::~Native2WrappedNativeMap() } size_t -Native2WrappedNativeMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +Native2WrappedNativeMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); @@ -148,7 +149,7 @@ Native2WrappedNativeMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) /* static */ size_t Native2WrappedNativeMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, - JSMallocSizeOfFun mallocSizeOf, void *) + mozilla::MallocSizeOf mallocSizeOf, void *) { return mallocSizeOf(((Native2WrappedNativeMap::Entry*)hdr)->value); } @@ -227,7 +228,7 @@ IID2NativeInterfaceMap::~IID2NativeInterfaceMap() } size_t -IID2NativeInterfaceMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +IID2NativeInterfaceMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); @@ -237,7 +238,7 @@ IID2NativeInterfaceMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) /* static */ size_t IID2NativeInterfaceMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, - JSMallocSizeOfFun mallocSizeOf, void *) + mozilla::MallocSizeOf mallocSizeOf, void *) { XPCNativeInterface *iface = ((IID2NativeInterfaceMap::Entry*)hdr)->value; return iface->SizeOfIncludingThis(mallocSizeOf); @@ -270,7 +271,7 @@ ClassInfo2NativeSetMap::~ClassInfo2NativeSetMap() } size_t -ClassInfo2NativeSetMap::ShallowSizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +ClassInfo2NativeSetMap::ShallowSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); @@ -310,7 +311,7 @@ ClassInfo2WrappedNativeProtoMap::~ClassInfo2WrappedNativeProtoMap() } size_t -ClassInfo2WrappedNativeProtoMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +ClassInfo2WrappedNativeProtoMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); @@ -320,7 +321,7 @@ ClassInfo2WrappedNativeProtoMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSiz /* static */ size_t ClassInfo2WrappedNativeProtoMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, - JSMallocSizeOfFun mallocSizeOf, void *) + mozilla::MallocSizeOf mallocSizeOf, void *) { return mallocSizeOf(((ClassInfo2WrappedNativeProtoMap::Entry*)hdr)->value); } @@ -434,7 +435,7 @@ NativeSetMap::~NativeSetMap() } size_t -NativeSetMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +NativeSetMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); @@ -443,7 +444,7 @@ NativeSetMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) } /* static */ size_t -NativeSetMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, JSMallocSizeOfFun mallocSizeOf, void *) +NativeSetMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *) { XPCNativeSet *set = ((NativeSetMap::Entry*)hdr)->key_value; return set->SizeOfIncludingThis(mallocSizeOf); diff --git a/js/xpconnect/src/XPCMaps.h b/js/xpconnect/src/XPCMaps.h index 168acaec6..b921bd263 100644 --- a/js/xpconnect/src/XPCMaps.h +++ b/js/xpconnect/src/XPCMaps.h @@ -9,6 +9,8 @@ #ifndef xpcmaps_h___ #define xpcmaps_h___ +#include "mozilla/MemoryReporting.h" + #include "js/HashTable.h" // Maps... @@ -68,7 +70,7 @@ public: void ShutdownMarker(JSRuntime* rt); - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) { + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { size_t n = mallocSizeOf(this); n += mTable.sizeOfExcludingThis(mallocSizeOf); return n; @@ -136,14 +138,14 @@ public: inline uint32_t Enumerate(PLDHashEnumerator f, void *arg) {return PL_DHashTableEnumerate(mTable, f, arg);} - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); ~Native2WrappedNativeMap(); private: Native2WrappedNativeMap(); // no implementation Native2WrappedNativeMap(int size); - static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, JSMallocSizeOfFun mallocSizeOf, void *); + static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *); private: PLDHashTable *mTable; @@ -255,14 +257,14 @@ public: inline uint32_t Enumerate(PLDHashEnumerator f, void *arg) {return PL_DHashTableEnumerate(mTable, f, arg);} - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); ~IID2NativeInterfaceMap(); private: IID2NativeInterfaceMap(); // no implementation IID2NativeInterfaceMap(int size); - static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, JSMallocSizeOfFun mallocSizeOf, void *); + static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *); private: PLDHashTable *mTable; @@ -318,7 +320,7 @@ public: // So we don't want to count those XPCNativeSets, because they are better // counted elsewhere (i.e. in XPCJSRuntime::mNativeSetMap, which holds // pointers to *all* XPCNativeSets). Hence the "Shallow". - size_t ShallowSizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t ShallowSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); ~ClassInfo2NativeSetMap(); private: @@ -374,14 +376,14 @@ public: inline uint32_t Enumerate(PLDHashEnumerator f, void *arg) {return PL_DHashTableEnumerate(mTable, f, arg);} - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); ~ClassInfo2WrappedNativeProtoMap(); private: ClassInfo2WrappedNativeProtoMap(); // no implementation ClassInfo2WrappedNativeProtoMap(int size); - static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, JSMallocSizeOfFun mallocSizeOf, void *); + static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *); private: PLDHashTable *mTable; @@ -447,14 +449,14 @@ public: inline uint32_t Enumerate(PLDHashEnumerator f, void *arg) {return PL_DHashTableEnumerate(mTable, f, arg);} - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); ~NativeSetMap(); private: NativeSetMap(); // no implementation NativeSetMap(int size); - static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, JSMallocSizeOfFun mallocSizeOf, void *); + static size_t SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *); private: PLDHashTable *mTable; diff --git a/js/xpconnect/src/XPCWrappedNativeInfo.cpp b/js/xpconnect/src/XPCWrappedNativeInfo.cpp index a900b78d4..8d51952d1 100644 --- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp +++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp @@ -9,6 +9,7 @@ #include "xpcprivate.h" #include "nsCxPusher.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/XPTInterfaceInfoManager.h" using namespace JS; @@ -388,7 +389,7 @@ XPCNativeInterface::DestroyInstance(XPCNativeInterface* inst) } size_t -XPCNativeInterface::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +XPCNativeInterface::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) { return mallocSizeOf(this); } @@ -798,7 +799,7 @@ XPCNativeSet::DestroyInstance(XPCNativeSet* inst) } size_t -XPCNativeSet::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +XPCNativeSet::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) { return mallocSizeOf(this); } diff --git a/js/xpconnect/src/XPCWrappedNativeScope.cpp b/js/xpconnect/src/XPCWrappedNativeScope.cpp index 223fcc46e..084b8ca94 100644 --- a/js/xpconnect/src/XPCWrappedNativeScope.cpp +++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp @@ -11,6 +11,7 @@ #include "nsContentUtils.h" #include "nsCycleCollectionNoteRootCallback.h" #include "nsPrincipal.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/dom/BindingUtils.h" @@ -791,7 +792,7 @@ XPCWrappedNativeScope::DebugDump(int16_t depth) } size_t -XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(nsMallocSizeOfFun mallocSizeOf) +XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(MallocSizeOf mallocSizeOf) { XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance(); XPCAutoLock lock(rt->GetMapLock()); @@ -804,7 +805,7 @@ XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(nsMallocSizeOfFun mallocSize } size_t -XPCWrappedNativeScope::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) +XPCWrappedNativeScope::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) { size_t n = 0; n += mallocSizeOf(this); diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 977fb1ff8..4112146d1 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -77,6 +77,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/StandardInteger.h" #include "mozilla/Util.h" @@ -838,7 +839,7 @@ public: static void CTypesActivityCallback(JSContext *cx, js::CTypesActivityType type); - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); AutoMarkingPtr** GetAutoRootsAdr() {return &mAutoRoots;} @@ -1393,10 +1394,10 @@ public: DebugDump(int16_t depth); static size_t - SizeOfAllScopesIncludingThis(nsMallocSizeOfFun mallocSizeOf); + SizeOfAllScopesIncludingThis(mozilla::MallocSizeOf mallocSizeOf); size_t - SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); JSBool IsValid() const {return mRuntime != nullptr;} @@ -1618,7 +1619,7 @@ class XPCNativeInterface static void DestroyInstance(XPCNativeInterface* inst); - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); protected: static XPCNativeInterface* NewInstance(nsIInterfaceInfo* aInfo); @@ -1786,7 +1787,7 @@ class XPCNativeSet static void DestroyInstance(XPCNativeSet* inst); - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); protected: static XPCNativeSet* NewInstance(XPCNativeInterface** array, diff --git a/layout/base/FramePropertyTable.cpp b/layout/base/FramePropertyTable.cpp index f9ffc5566..ffe6c7658 100644 --- a/layout/base/FramePropertyTable.cpp +++ b/layout/base/FramePropertyTable.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "FramePropertyTable.h" + +#include "mozilla/MemoryReporting.h" + #include "prlog.h" namespace mozilla { @@ -228,7 +231,7 @@ FramePropertyTable::DeleteAll() } size_t -FramePropertyTable::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +FramePropertyTable::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return mEntries.SizeOfExcludingThis(SizeOfPropertyTableEntryExcludingThis, aMallocSizeOf); @@ -236,7 +239,7 @@ FramePropertyTable::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const /* static */ size_t FramePropertyTable::SizeOfPropertyTableEntryExcludingThis(Entry* aEntry, - nsMallocSizeOfFun aMallocSizeOf, void *) + mozilla::MallocSizeOf aMallocSizeOf, void *) { return aEntry->mProp.SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/base/FramePropertyTable.h b/layout/base/FramePropertyTable.h index acfaa927b..7fa11de2f 100644 --- a/layout/base/FramePropertyTable.h +++ b/layout/base/FramePropertyTable.h @@ -6,6 +6,7 @@ #ifndef FRAMEPROPERTYTABLE_H_ #define FRAMEPROPERTYTABLE_H_ +#include "mozilla/MemoryReporting.h" #include "nsTArray.h" #include "nsTHashtable.h" #include "nsHashKeys.h" @@ -123,7 +124,7 @@ public: */ void DeleteAll(); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; protected: /** @@ -150,7 +151,7 @@ protected: } } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) { size_t n = 0; // We don't need to measure mProperty because it always points to static // memory. As for mValue: if it's a single value we can't measure it, @@ -203,7 +204,7 @@ protected: static PLDHashOperator DeleteEnumerator(Entry* aEntry, void* aArg); static size_t SizeOfPropertyTableEntryExcludingThis(Entry* aEntry, - nsMallocSizeOfFun aMallocSizeOf, void *); + mozilla::MallocSizeOf aMallocSizeOf, void *); nsTHashtable mEntries; nsIFrame* mLastFrame; diff --git a/layout/base/StackArena.cpp b/layout/base/StackArena.cpp index c26fe7f35..55aa3d8e3 100644 --- a/layout/base/StackArena.cpp +++ b/layout/base/StackArena.cpp @@ -4,6 +4,8 @@ #include "StackArena.h" +#include "mozilla/MemoryReporting.h" + namespace mozilla { #define STACK_ARENA_MARK_INCREMENT 50 @@ -67,7 +69,7 @@ StackArena::~StackArena() } size_t -StackArena::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +StackArena::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; StackBlock *block = mBlocks; diff --git a/layout/base/StackArena.h b/layout/base/StackArena.h index d9f39f402..018258d2d 100644 --- a/layout/base/StackArena.h +++ b/layout/base/StackArena.h @@ -3,6 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/Assertions.h" +#include "mozilla/MemoryReporting.h" #include "nsAlgorithm.h" #include "nsDebug.h" @@ -28,7 +29,7 @@ private: void Push(); void Pop(); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; // our current position in memory size_t mPos; diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index c470ba8e7..c14dcafa8 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -20,6 +20,7 @@ #ifndef nsIPresShell_h___ #define nsIPresShell_h___ +#include "mozilla/MemoryReporting.h" #include "nsTHashtable.h" #include "nsHashKeys.h" #include "nsISupports.h" @@ -1270,7 +1271,7 @@ public: virtual bool IsVisible() = 0; virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange) = 0; - virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, nsArenaMemoryStats *aArenaObjectsSize, size_t *aPresShellSize, size_t *aStyleSetsSize, diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index dbc6d59ad..82bd58095 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "base/basictypes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "nsLayoutUtils.h" @@ -5259,7 +5260,7 @@ nsLayoutUtils::GetFontFacesForText(nsIFrame* aFrame, /* static */ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, bool clear) { NS_PRECONDITION(aFrame, "NULL frame pointer"); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 748196b5d..e6561a6a3 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -20,6 +20,7 @@ class nsClientRectList; class nsFontFaceList; class nsIImageLoadingContent; +#include "mozilla/MemoryReporting.h" #include "nsChangeHint.h" #include "nsStyleContext.h" #include "nsAutoPtr.h" @@ -1620,7 +1621,7 @@ public: * total = SizeOfTextRunsForFrames(rootFrame, mallocSizeOf, false); */ static size_t SizeOfTextRunsForFrames(nsIFrame* aFrame, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, bool clear); /** diff --git a/layout/base/nsPresArena.cpp b/layout/base/nsPresArena.cpp index be0f0f57f..0e6128b43 100644 --- a/layout/base/nsPresArena.cpp +++ b/layout/base/nsPresArena.cpp @@ -19,6 +19,7 @@ #include "nsPresArena.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Poison.h" #include "nsCRT.h" #include "nsDebug.h" @@ -116,7 +117,7 @@ nsPresArena::Free(uint32_t aCode, void* aPtr) /* static */ size_t nsPresArena::SizeOfFreeListEntryExcludingThis( - FreeList* aEntry, nsMallocSizeOfFun aMallocSizeOf, void*) + FreeList* aEntry, mozilla::MallocSizeOf aMallocSizeOf, void*) { return aEntry->mEntries.SizeOfExcludingThis(aMallocSizeOf); } @@ -179,7 +180,7 @@ nsPresArena::FreeListEnumerator(FreeList* aEntry, void* aData) } void -nsPresArena::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, +nsPresArena::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, nsArenaMemoryStats* aArenaStats) { // We do a complicated dance here because we want to measure the diff --git a/layout/base/nsPresArena.h b/layout/base/nsPresArena.h index a3a3ad4d0..af586272a 100644 --- a/layout/base/nsPresArena.h +++ b/layout/base/nsPresArena.h @@ -11,6 +11,7 @@ #define nsPresArena_h___ #include "mozilla/MemoryChecking.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/StandardInteger.h" #include "nscore.h" #include "nsQueryFrame.h" @@ -84,7 +85,7 @@ public: * Fill aArenaStats with sizes of interesting objects allocated in * this arena and its mOther field with the size of everything else. */ - void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, nsArenaMemoryStats* aArenaStats); private: @@ -125,7 +126,7 @@ private: #endif static PLDHashOperator FreeListEnumerator(FreeList* aEntry, void* aData); static size_t SizeOfFreeListEntryExcludingThis(FreeList* aEntry, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void*); nsTHashtable mFreeLists; diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 022d1e9bd..ced2fc1b8 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -59,6 +59,7 @@ #include "nsObjectFrame.h" #include "nsTransitionManager.h" #include "nsAnimationManager.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsIMessageManager.h" #include "FrameLayerBuilder.h" @@ -2521,7 +2522,7 @@ nsPresContext::GetPrimaryFrameFor(nsIContent* aContent) size_t -nsPresContext::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsPresContext::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return mPropertyTable.SizeOfExcludingThis(aMallocSizeOf); mLangGroupFontPrefs.SizeOfExcludingThis(aMallocSizeOf); @@ -2857,7 +2858,7 @@ nsRootPresContext::FlushWillPaintObservers() } size_t -nsRootPresContext::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsRootPresContext::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return nsPresContext::SizeOfExcludingThis(aMallocSizeOf); diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 8254b0bd4..138734577 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -31,6 +31,7 @@ #include "nsTArray.h" #include "nsAutoPtr.h" #include "nsIWidget.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "prclist.h" #include "Layers.h" @@ -953,8 +954,8 @@ public: PropertyTable()->DeleteAllFor(aFrame); } - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } @@ -1056,7 +1057,7 @@ protected: NS_FONT_STRETCH_NORMAL, 0, 0) {} - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; LangGroupFontPrefs *curr = mNext; while (curr) { @@ -1420,7 +1421,7 @@ public: */ void FlushWillPaintObservers(); - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; protected: /** diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 265dcce44..cd730f252 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -18,6 +18,7 @@ /* a presentation of a document, part 2 */ +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/PBrowserChild.h" #include "mozilla/dom/TabChild.h" #include "mozilla/Likely.h" @@ -8722,7 +8723,7 @@ PresShell::GetRootPresShell() } void -PresShell::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +PresShell::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, nsArenaMemoryStats *aArenaObjectsSize, size_t *aPresShellSize, size_t *aStyleSetsSize, @@ -8741,7 +8742,7 @@ PresShell::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, } size_t -PresShell::SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf) const +PresShell::SizeOfTextRuns(MallocSizeOf aMallocSizeOf) const { nsIFrame* rootFrame = mFrameConstructor->GetRootFrame(); if (!rootFrame) { diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 0fa17a08e..565803543 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -36,6 +36,7 @@ #include "nsContentUtils.h" // For AddScriptBlocker(). #include "nsRefreshDriver.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" class nsRange; class nsIDragService; @@ -297,13 +298,13 @@ public: IsLayoutFlushObserver(this); } - void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, nsArenaMemoryStats *aArenaObjectsSize, size_t *aPresShellSize, size_t *aStyleSetsSize, size_t *aTextRunsSize, size_t *aPresContextSize) MOZ_OVERRIDE; - size_t SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfTextRuns(mozilla::MallocSizeOf aMallocSizeOf) const; virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) MOZ_OVERRIDE; diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index 6eab68a05..a335fc307 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -8,6 +8,7 @@ #include "prlog.h" #include "nsStyleSheetService.h" #include "nsIStyleSheet.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Loader.h" #include "nsCSSStyleSheet.h" #include "nsIURI.h" @@ -255,7 +256,7 @@ nsStyleSheetService::GetInstance() } size_t -nsStyleSheetService::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsStyleSheetService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { if (!nsStyleSheetService::gInstance) { return 0; @@ -267,13 +268,13 @@ nsStyleSheetService::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) static size_t SizeOfElementIncludingThis(nsIStyleSheet* aElement, - nsMallocSizeOfFun aMallocSizeOf, void *aData) + mozilla::MallocSizeOf aMallocSizeOf, void *aData) { return aElement->SizeOfIncludingThis(aMallocSizeOf); } size_t -nsStyleSheetService::SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const +nsStyleSheetService::SizeOfIncludingThisHelper(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mSheets[AGENT_SHEET].SizeOfExcludingThis(SizeOfElementIncludingThis, diff --git a/layout/base/nsStyleSheetService.h b/layout/base/nsStyleSheetService.h index fa7d4be04..31434e1eb 100644 --- a/layout/base/nsStyleSheetService.h +++ b/layout/base/nsStyleSheetService.h @@ -12,6 +12,7 @@ #include "nsCOMArray.h" #include "nsIStyleSheet.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" class nsISimpleEnumerator; class nsICategoryManager; @@ -39,7 +40,7 @@ class nsStyleSheetService MOZ_FINAL : public nsIStyleSheetService nsCOMArray* UserStyleSheets() { return &mSheets[USER_SHEET]; } nsCOMArray* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; } - static size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + static size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); static nsStyleSheetService *GetInstance(); static nsStyleSheetService *gInstance; @@ -59,7 +60,7 @@ class nsStyleSheetService MOZ_FINAL : public nsIStyleSheetService NS_HIDDEN_(nsresult) LoadAndRegisterSheetInternal(nsIURI *aSheetURI, uint32_t aSheetType); - size_t SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThisHelper(mozilla::MallocSizeOf aMallocSizeOf) const; nsCOMArray mSheets[3]; diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index faf3d4656..1932ed51e 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -5,6 +5,8 @@ #include "nsTextRunTransformations.h" +#include "mozilla/MemoryReporting.h" + #include "nsTextFrameUtils.h" #include "gfxSkipChars.h" #include "nsGkAtoms.h" @@ -357,7 +359,7 @@ nsTransformedTextRun::SetPotentialLineBreaks(uint32_t aStart, uint32_t aLength, } size_t -nsTransformedTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsTransformedTextRun::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) { size_t total = gfxTextRun::SizeOfExcludingThis(aMallocSizeOf); total += mStyles.SizeOfExcludingThis(aMallocSizeOf); @@ -369,7 +371,7 @@ nsTransformedTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) } size_t -nsTransformedTextRun::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsTransformedTextRun::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/generic/nsTextRunTransformations.h b/layout/generic/nsTextRunTransformations.h index 200f5dfe6..b04d1f446 100644 --- a/layout/generic/nsTextRunTransformations.h +++ b/layout/generic/nsTextRunTransformations.h @@ -7,6 +7,7 @@ #define NSTEXTRUNTRANSFORMATIONS_H_ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "gfxFont.h" class nsTransformedTextRun; @@ -102,8 +103,8 @@ public: } // override the gfxTextRun impls to account for additional members here - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) MOZ_MUST_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) MOZ_MUST_OVERRIDE; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) MOZ_MUST_OVERRIDE; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) MOZ_MUST_OVERRIDE; nsTransformingTextRunFactory *mFactory; nsTArray > mStyles; diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index 5e669d4d4..93ee787c4 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -15,6 +15,7 @@ #include "Layers.h" #include "FrameLayerBuilder.h" #include "nsDisplayList.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" using namespace mozilla::layers; @@ -121,7 +122,7 @@ CommonAnimationManager::MediumFeaturesChanged(nsPresContext* aPresContext) } /* virtual */ size_t -CommonAnimationManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +CommonAnimationManager::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { // Measurement of the following members may be added later if DMD finds it is // worthwhile: @@ -134,7 +135,7 @@ CommonAnimationManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) con } /* virtual */ size_t -CommonAnimationManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +CommonAnimationManager::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 7a4fb7bf5..a247ddd09 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -12,6 +12,7 @@ #include "prclist.h" #include "nsStyleAnimation.h" #include "nsCSSProperty.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsSMILKeySpline.h" #include "nsStyleStruct.h" @@ -42,9 +43,9 @@ public: virtual nsRestyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData) MOZ_OVERRIDE; virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) MOZ_OVERRIDE; - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; /** diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 3c2a2c736..552ce4477 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -8,6 +8,7 @@ * stylesheet */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/css/Declaration.h" @@ -1103,7 +1104,7 @@ Declaration::EnsureMutable() } size_t -Declaration::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +Declaration::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mOrder.SizeOfExcludingThis(aMallocSizeOf); diff --git a/layout/style/Declaration.h b/layout/style/Declaration.h index b1edad385..d83fb348c 100644 --- a/layout/style/Declaration.h +++ b/layout/style/Declaration.h @@ -12,6 +12,7 @@ #define mozilla_css_Declaration_h #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" // This header is in EXPORTS because it's used in several places in content/, // but it's not really a public interface. @@ -227,7 +228,7 @@ public: return nsCSSProperty(mOrder.ElementAt(aValue)); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: nsAutoTArray mOrder; diff --git a/layout/style/GroupRule.h b/layout/style/GroupRule.h index c9c980c6d..649437ee1 100644 --- a/layout/style/GroupRule.h +++ b/layout/style/GroupRule.h @@ -12,6 +12,7 @@ #define mozilla_css_GroupRule_h__ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Rule.h" #include "nsCOMArray.h" #include "nsAutoPtr.h" @@ -69,8 +70,8 @@ public: nsMediaQueryResultCacheKey& aKey) = 0; // non-virtual -- it is only called by subclasses - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; protected: // to help implement nsIDOMCSSRule diff --git a/layout/style/ImportRule.h b/layout/style/ImportRule.h index e8df0bf63..f5b0d77b6 100644 --- a/layout/style/ImportRule.h +++ b/layout/style/ImportRule.h @@ -10,6 +10,7 @@ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Rule.h" #include "nsIDOMCSSImportRule.h" #include "nsCSSRules.h" @@ -49,7 +50,7 @@ public: void SetSheet(nsCSSStyleSheet*); - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; // nsIDOMCSSRule interface NS_DECL_NSIDOMCSSRULE diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 030bf8369..fa938e6e5 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -16,6 +16,7 @@ /* loading of CSS style sheets using the network APIs */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/css/Loader.h" @@ -2442,13 +2443,13 @@ Loader::UnlinkCachedSheets() struct SheetMemoryCounter { size_t size; - nsMallocSizeOfFun mallocSizeOf; + mozilla::MallocSizeOf mallocSizeOf; }; static size_t CountSheetMemory(URIPrincipalAndCORSModeHashKey* /* unused */, const nsRefPtr& aSheet, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* /* unused */) { // If aSheet has a parent, then its parent will report it so we don't @@ -2462,7 +2463,7 @@ CountSheetMemory(URIPrincipalAndCORSModeHashKey* /* unused */, } size_t -Loader::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +Loader::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t s = aMallocSizeOf(this); diff --git a/layout/style/Loader.h b/layout/style/Loader.h index 70111049f..0a0f68874 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -20,6 +20,7 @@ #include "nsURIHashKey.h" #include "mozilla/Attributes.h" #include "mozilla/CORSMode.h" +#include "mozilla/MemoryReporting.h" class nsIAtom; class nsICSSLoaderObserver; @@ -368,7 +369,7 @@ public: void UnlinkCachedSheets(); // Measure our size. - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: friend class SheetLoadData; diff --git a/layout/style/NameSpaceRule.h b/layout/style/NameSpaceRule.h index b49505af2..1df6212da 100644 --- a/layout/style/NameSpaceRule.h +++ b/layout/style/NameSpaceRule.h @@ -9,6 +9,7 @@ #define mozilla_css_NameSpaceRule_h__ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Rule.h" #include "nsIDOMCSSRule.h" @@ -52,7 +53,7 @@ public: void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; } - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE; // nsIDOMCSSRule interface diff --git a/layout/style/Rule.h b/layout/style/Rule.h index 900040533..fce3043d3 100644 --- a/layout/style/Rule.h +++ b/layout/style/Rule.h @@ -8,6 +8,7 @@ #ifndef mozilla_css_Rule_h___ #define mozilla_css_Rule_h___ +#include "mozilla/MemoryReporting.h" #include "nsIStyleRule.h" #include "nsIDOMCSSRule.h" #include "nsCSSStyleSheet.h" @@ -111,12 +112,12 @@ public: // This is pure virtual because all of Rule's data members are non-owning and // thus measured elsewhere. - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE = 0; // This is used to measure nsCOMArrays. static size_t SizeOfCOMArrayElementIncludingThis(css::Rule* aElement, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void* aData); protected: diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 69f67a61f..441f8e808 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -10,6 +10,8 @@ */ #include "mozilla/css/StyleRule.h" + +#include "mozilla/MemoryReporting.h" #include "mozilla/css/GroupRule.h" #include "mozilla/css/Declaration.h" #include "nsCSSStyleSheet.h" @@ -82,7 +84,7 @@ nsAtomList::Clone(bool aDeep) const } size_t -nsAtomList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsAtomList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsAtomList* a = this; @@ -177,7 +179,7 @@ nsPseudoClassList::Clone(bool aDeep) const } size_t -nsPseudoClassList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsPseudoClassList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsPseudoClassList* p = this; @@ -809,7 +811,7 @@ nsCSSSelector::CanBeNamespaced(bool aIsNegated) const } size_t -nsCSSSelector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSSelector::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsCSSSelector* s = this; @@ -899,7 +901,7 @@ nsCSSSelectorList::Clone(bool aDeep) const } size_t -nsCSSSelectorList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSSelectorList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsCSSSelectorList* s = this; @@ -1501,7 +1503,7 @@ StyleRule::SetSelectorText(const nsAString& aSelectorText) } /* virtual */ size_t -StyleRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +StyleRule::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mSelector ? mSelector->SizeOfIncludingThis(aMallocSizeOf) : 0; diff --git a/layout/style/StyleRule.h b/layout/style/StyleRule.h index cd50bd902..a0949f163 100644 --- a/layout/style/StyleRule.h +++ b/layout/style/StyleRule.h @@ -14,6 +14,7 @@ #include "mozilla/Attributes.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Rule.h" #include "nsString.h" @@ -36,7 +37,7 @@ public: /** Do a deep clone. Should be used only on the first in the linked list. */ nsAtomList* Clone() const { return Clone(true); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsCOMPtr mAtom; nsAtomList* mNext; @@ -59,7 +60,7 @@ public: /** Do a deep clone. Should be used only on the first in the linked list. */ nsPseudoClassList* Clone() const { return Clone(true); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; union { // For a given value of mType, we have either: @@ -189,7 +190,7 @@ public: mPseudoType = static_cast(aType); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; // For case-sensitive documents, mLowercaseTag is the same as mCasedTag, // but in case-insensitive documents (HTML) mLowercaseTag is lowercase. @@ -247,7 +248,7 @@ struct nsCSSSelectorList { */ nsCSSSelectorList* Clone() const { return Clone(true); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsCSSSelector* mSelectors; int32_t mWeight; @@ -365,7 +366,7 @@ public: virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE; #endif - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: ~StyleRule(); diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 976325176..413c5ee15 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsAnimationManager.h" + +#include "mozilla/MemoryReporting.h" + #include "nsPresContext.h" #include "nsRuleProcessorData.h" #include "nsStyleSet.h" @@ -518,7 +521,7 @@ nsAnimationManager::RulesMatching(XULTreeRuleProcessorData* aData) #endif /* virtual */ size_t -nsAnimationManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsAnimationManager::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf); @@ -528,7 +531,7 @@ nsAnimationManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } /* virtual */ size_t -nsAnimationManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsAnimationManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index 06a6fd383..c89822ac7 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -11,6 +11,7 @@ #include "nsStyleContext.h" #include "nsDataHashtable.h" #include "nsGUIEvent.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "mozilla/Preferences.h" #include "nsThreadUtils.h" @@ -231,9 +232,9 @@ public: #ifdef MOZ_XUL virtual void RulesMatching(XULTreeRuleProcessorData* aData) MOZ_OVERRIDE; #endif - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; // nsARefreshObserver diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index d3fe76b14..c08b0af3b 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -9,6 +9,7 @@ */ #include "nsCSSDataBlock.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Declaration.h" #include "mozilla/css/ImageLoader.h" #include "nsRuleData.h" @@ -226,7 +227,7 @@ nsCSSCompressedDataBlock::CreateEmptyBlock() } size_t -nsCSSCompressedDataBlock::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSCompressedDataBlock::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); for (uint32_t i = 0; i < mNumProps; i++) { diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index e12a119ec..12d328666 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -11,6 +11,7 @@ #ifndef nsCSSDataBlock_h__ #define nsCSSDataBlock_h__ +#include "mozilla/MemoryReporting.h" #include "nsCSSProps.h" #include "nsCSSPropertySet.h" @@ -81,7 +82,7 @@ public: */ static nsCSSCompressedDataBlock* CreateEmptyBlock(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; bool HasDefaultBorderImageSlice() const; bool HasDefaultBorderImageWidth() const; diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index a240cd7aa..eae39129b 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -23,6 +23,7 @@ #include "nsIAtom.h" #include "pldhash.h" #include "nsICSSPseudoComparator.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/StyleRule.h" #include "mozilla/css/GroupRule.h" #include "nsIDocument.h" @@ -456,8 +457,8 @@ public: void EnumerateAllRules(Element* aElement, ElementDependentRuleProcessorData* aData, NodeMatchContext& aNodeMatchContext); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const; + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; protected: typedef nsTArray RuleValueList; @@ -794,14 +795,14 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso } static size_t -SizeOfRuleHashTableEntry(PLDHashEntryHdr* aHdr, nsMallocSizeOfFun aMallocSizeOf, void *) +SizeOfRuleHashTableEntry(PLDHashEntryHdr* aHdr, MallocSizeOf aMallocSizeOf, void *) { RuleHashTableEntry* entry = static_cast(aHdr); return entry->mRules.SizeOfExcludingThis(aMallocSizeOf); } size_t -RuleHash::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +RuleHash::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; @@ -835,7 +836,7 @@ RuleHash::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -RuleHash::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +RuleHash::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } @@ -960,7 +961,7 @@ struct RuleCascadeData { } } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; RuleHash mRuleHash; RuleHash* @@ -995,14 +996,14 @@ struct RuleCascadeData { }; static size_t -SizeOfSelectorsEntry(PLDHashEntryHdr* aHdr, nsMallocSizeOfFun aMallocSizeOf, void *) +SizeOfSelectorsEntry(PLDHashEntryHdr* aHdr, MallocSizeOf aMallocSizeOf, void *) { AtomSelectorEntry* entry = static_cast(aHdr); return entry->mSelectors.SizeOfExcludingThis(aMallocSizeOf); } size_t -RuleCascadeData::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +RuleCascadeData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); @@ -2735,7 +2736,7 @@ nsCSSRuleProcessor::MediumFeaturesChanged(nsPresContext* aPresContext) } /* virtual */ size_t -nsCSSRuleProcessor::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSRuleProcessor::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; n += mSheets.SizeOfExcludingThis(aMallocSizeOf); @@ -2748,7 +2749,7 @@ nsCSSRuleProcessor::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } /* virtual */ size_t -nsCSSRuleProcessor::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSRuleProcessor::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index fe8508a7b..2388dac4f 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -13,6 +13,7 @@ #define nsCSSRuleProcessor_h_ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsIStyleRuleProcessor.h" #include "nsCSSStyleSheet.h" #include "nsTArray.h" @@ -112,9 +113,9 @@ public: virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) MOZ_OVERRIDE; - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; // Append all the currently-active font face rules to aArray. Return diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index c74b9f5ad..f7743ed9b 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -9,6 +9,7 @@ #include "nsCSSRules.h" #include "nsCSSValue.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/ImportRule.h" #include "mozilla/css/NameSpaceRule.h" @@ -117,7 +118,7 @@ Rule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet) size_t Rule::SizeOfCOMArrayElementIncludingThis(css::Rule* aElement, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aData) { return aElement->SizeOfIncludingThis(aMallocSizeOf); @@ -328,7 +329,7 @@ CharsetRule::GetParentRule(nsIDOMCSSRule** aParentRule) } /* virtual */ size_t -CharsetRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +CharsetRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); @@ -504,7 +505,7 @@ ImportRule::GetStyleSheet(nsIDOMCSSStyleSheet * *aStyleSheet) } /* virtual */ size_t -ImportRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +ImportRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); @@ -766,7 +767,7 @@ GroupRule::DeleteRule(uint32_t aIndex) } /* virtual */ size_t -GroupRule::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +GroupRule::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return mRules.SizeOfExcludingThis(Rule::SizeOfCOMArrayElementIncludingThis, aMallocSizeOf); @@ -970,7 +971,7 @@ MediaRule::UseForPresentation(nsPresContext* aPresContext, } /* virtual */ size_t -MediaRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +MediaRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += GroupRule::SizeOfExcludingThis(aMallocSizeOf); @@ -1200,7 +1201,7 @@ DocumentRule::URL::~URL() } /* virtual */ size_t -DocumentRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +DocumentRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += GroupRule::SizeOfExcludingThis(aMallocSizeOf); @@ -1361,7 +1362,7 @@ NameSpaceRule::GetParentRule(nsIDOMCSSRule** aParentRule) } /* virtual */ size_t -NameSpaceRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +NameSpaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); @@ -1901,7 +1902,7 @@ nsCSSFontFaceRule::GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue) } /* virtual */ size_t -nsCSSFontFaceRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSFontFaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); @@ -2155,7 +2156,7 @@ nsCSSFontFeatureValuesRule::AddValueList(int32_t aVariantAlternate, size_t nsCSSFontFeatureValuesRule::SizeOfIncludingThis( - nsMallocSizeOfFun aMallocSizeOf) const + MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); } @@ -2424,7 +2425,7 @@ nsCSSKeyframeRule::ChangeDeclaration(css::Declaration* aDeclaration) } /* virtual */ size_t -nsCSSKeyframeRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSKeyframeRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); @@ -2639,7 +2640,7 @@ nsCSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext, } /* virtual */ size_t -nsCSSKeyframesRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSKeyframesRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += GroupRule::SizeOfExcludingThis(aMallocSizeOf); @@ -2870,7 +2871,7 @@ nsCSSPageRule::ChangeDeclaration(css::Declaration* aDeclaration) } /* virtual */ size_t -nsCSSPageRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSPageRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); } @@ -3005,7 +3006,7 @@ CSSSupportsRule::SetConditionText(const nsAString& aConditionText) } /* virtual */ size_t -CSSSupportsRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +CSSSupportsRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += css::GroupRule::SizeOfExcludingThis(aMallocSizeOf); diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index 1c637ceb3..58d0ab1ad 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -11,6 +11,7 @@ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/GroupRule.h" #include "mozilla/Preferences.h" #include "nsIDOMCSSConditionRule.h" @@ -91,7 +92,7 @@ public: // @media rule methods nsresult SetMedia(nsMediaList* aMedia); - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE; protected: @@ -169,7 +170,7 @@ public: void SetURLs(URL *aURLs) { mURLs = aURLs; } - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE; protected: @@ -259,7 +260,7 @@ public: void SetDesc(nsCSSFontDesc aDescID, nsCSSValue const & aValue); void GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue); - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; protected: friend class nsCSSFontFaceStyleDecl; @@ -330,7 +331,7 @@ public: return mFeatureValues; } - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; static bool PrefEnabled() { @@ -376,7 +377,7 @@ public: NS_IMETHOD GetEncoding(nsAString& aEncoding) MOZ_OVERRIDE; NS_IMETHOD SetEncoding(const nsAString& aEncoding) MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: nsString mEncoding; @@ -451,7 +452,7 @@ public: void ChangeDeclaration(mozilla::css::Declaration* aDeclaration); - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; void DoGetKeyText(nsAString &aKeyText) const; @@ -505,7 +506,7 @@ public: const nsString& GetName() { return mName; } - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; private: uint32_t FindRuleIndexForKey(const nsAString& aKey); @@ -579,7 +580,7 @@ public: mozilla::css::ImportantRule* GetImportantRule(); - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; private: nsAutoPtr mDeclaration; // lazily created when needed: @@ -629,7 +630,7 @@ public: // nsIDOMCSSSupportsRule interface NS_DECL_NSIDOMCSSSUPPORTSRULE - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; static bool PrefEnabled() { diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index 4dbe5bd85..e6ee7b645 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -10,6 +10,7 @@ #include "nsIAtom.h" #include "nsCSSRuleProcessor.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "mozilla/css/NameSpaceRule.h" #include "mozilla/css/GroupRule.h" @@ -845,7 +846,7 @@ nsCSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder) } size_t -nsCSSStyleSheet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsCSSStyleSheet* s = this; @@ -987,7 +988,7 @@ nsCSSStyleSheetInner::CreateNamespaceMap() } size_t -nsCSSStyleSheetInner::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mOrderedRules.SizeOfExcludingThis(css::Rule::SizeOfCOMArrayElementIncludingThis, diff --git a/layout/style/nsCSSStyleSheet.h b/layout/style/nsCSSStyleSheet.h index ab22fd3d5..4944c5bf8 100644 --- a/layout/style/nsCSSStyleSheet.h +++ b/layout/style/nsCSSStyleSheet.h @@ -10,6 +10,7 @@ #define nsCSSStyleSheet_h_ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nscore.h" @@ -66,7 +67,7 @@ private: // Create a new namespace map nsresult CreateNamespaceMap(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsAutoTArray mSheets; nsCOMPtr mSheetURI; // for error reports, etc. @@ -243,7 +244,7 @@ public: // list after we clone a unique inner for ourselves. static bool RebuildChildList(mozilla::css::Rule* aRule, void* aBuilder); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; // Get this style sheet's CORS mode mozilla::CORSMode GetCORSMode() const { return mInner->mCORSMode; } diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 644e43f7d..a0596e0d7 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -16,6 +16,7 @@ #include "nsStyleUtil.h" #include "CSSCalc.h" #include "nsNetUtil.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/ImageLoader.h" #include "mozilla/Likely.h" @@ -1252,7 +1253,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const } size_t -nsCSSValue::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; @@ -1454,7 +1455,7 @@ nsCSSValueList::operator==(const nsCSSValueList& aOther) const } size_t -nsCSSValueList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValueList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsCSSValueList* v = this; @@ -1467,7 +1468,7 @@ nsCSSValueList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -nsCSSValueList_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValueList_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mValue.SizeOfExcludingThis(aMallocSizeOf); @@ -1541,7 +1542,7 @@ void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue) } size_t -nsCSSRect_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSRect_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mTop .SizeOfExcludingThis(aMallocSizeOf); @@ -1576,7 +1577,7 @@ nsCSSValuePair::AppendToString(nsCSSProperty aProperty, } size_t -nsCSSValuePair::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValuePair::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; n += mXValue.SizeOfExcludingThis(aMallocSizeOf); @@ -1585,7 +1586,7 @@ nsCSSValuePair::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -nsCSSValuePair_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValuePair_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mXValue.SizeOfExcludingThis(aMallocSizeOf); @@ -1611,7 +1612,7 @@ nsCSSValueTriplet::AppendToString(nsCSSProperty aProperty, } size_t -nsCSSValueTriplet_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValueTriplet_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mXValue.SizeOfExcludingThis(aMallocSizeOf); @@ -1685,7 +1686,7 @@ nsCSSValuePairList::operator==(const nsCSSValuePairList& aOther) const } size_t -nsCSSValuePairList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValuePairList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; const nsCSSValuePairList* v = this; @@ -1699,7 +1700,7 @@ nsCSSValuePairList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -nsCSSValuePairList_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValuePairList_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mXValue.SizeOfExcludingThis(aMallocSizeOf); @@ -1709,7 +1710,7 @@ nsCSSValuePairList_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) co } size_t -nsCSSValue::Array::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValue::Array::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); for (size_t i = 0; i < mCount; i++) { @@ -1796,7 +1797,7 @@ css::URLValue::GetURI() const } size_t -css::URLValue::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +css::URLValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); @@ -1887,7 +1888,7 @@ nsCSSValueGradientStop::~nsCSSValueGradientStop() } size_t -nsCSSValueGradientStop::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValueGradientStop::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = 0; n += mLocation.SizeOfExcludingThis(aMallocSizeOf); @@ -1909,7 +1910,7 @@ nsCSSValueGradient::nsCSSValueGradient(bool aIsRadial, } size_t -nsCSSValueGradient::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsCSSValueGradient::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); n += mBgPos.SizeOfExcludingThis(aMallocSizeOf); diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index f8dcdff2d..51b2237a4 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -10,6 +10,7 @@ #include "mozilla/Attributes.h" #include "mozilla/FloatingPoint.h" +#include "mozilla/MemoryReporting.h" #include "nsCOMPtr.h" #include "nsCRTGlue.h" @@ -92,7 +93,7 @@ struct URLValue { nsIURI* GetURI() const; - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: // If mURIResolved is false, mURI stores the base URI. @@ -520,7 +521,7 @@ public: static already_AddRefed BufferFromString(const nsString& aValue); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: static const PRUnichar* GetBufferValue(nsStringBuffer* aBuffer) { @@ -645,7 +646,7 @@ private: } } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; #undef CSSVALUE_LIST_FOR_EXTRA_VALUES @@ -667,7 +668,7 @@ struct nsCSSValueList { bool operator!=(const nsCSSValueList& aOther) const { return !(*this == aOther); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsCSSValue mValue; nsCSSValueList* mNext; @@ -686,7 +687,7 @@ private: struct nsCSSValueList_heap : public nsCSSValueList { NS_INLINE_DECL_REFCOUNTING(nsCSSValueList_heap) - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; }; // This has to be here so that the relationship between nsCSSValueList @@ -773,7 +774,7 @@ struct nsCSSRect { struct nsCSSRect_heap : public nsCSSRect { NS_INLINE_DECL_REFCOUNTING(nsCSSRect_heap) - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; }; // This has to be here so that the relationship between nsCSSRect @@ -849,7 +850,7 @@ struct nsCSSValuePair { void AppendToString(nsCSSProperty aProperty, nsAString& aResult) const; - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsCSSValue mXValue; nsCSSValue mYValue; @@ -866,7 +867,7 @@ struct nsCSSValuePair_heap : public nsCSSValuePair { NS_INLINE_DECL_REFCOUNTING(nsCSSValuePair_heap) - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; }; struct nsCSSValueTriplet { @@ -950,7 +951,7 @@ struct nsCSSValueTriplet_heap : public nsCSSValueTriplet { NS_INLINE_DECL_REFCOUNTING(nsCSSValueTriplet_heap) - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; }; // This has to be here so that the relationship between nsCSSValuePair @@ -995,7 +996,7 @@ struct nsCSSValuePairList { bool operator!=(const nsCSSValuePairList& aOther) const { return !(*this == aOther); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsCSSValue mXValue; nsCSSValue mYValue; @@ -1015,7 +1016,7 @@ private: struct nsCSSValuePairList_heap : public nsCSSValuePairList { NS_INLINE_DECL_REFCOUNTING(nsCSSValuePairList_heap) - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; }; // This has to be here so that the relationship between nsCSSValuePairList @@ -1064,7 +1065,7 @@ public: return !(*this == aOther); } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; }; struct nsCSSValueGradient { @@ -1124,7 +1125,7 @@ public: NS_INLINE_DECL_REFCOUNTING(nsCSSValueGradient) - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: nsCSSValueGradient(const nsCSSValueGradient& aOther) MOZ_DELETE; diff --git a/layout/style/nsHTMLCSSStyleSheet.cpp b/layout/style/nsHTMLCSSStyleSheet.cpp index c3d3882b8..5ff8075e6 100644 --- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -8,6 +8,7 @@ */ #include "nsHTMLCSSStyleSheet.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/StyleRule.h" #include "nsIStyleRuleProcessor.h" #include "nsPresContext.h" @@ -133,13 +134,13 @@ nsHTMLCSSStyleSheet::MediumFeaturesChanged(nsPresContext* aPresContext) } /* virtual */ size_t -nsHTMLCSSStyleSheet::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsHTMLCSSStyleSheet::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return 0; } /* virtual */ size_t -nsHTMLCSSStyleSheet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsHTMLCSSStyleSheet::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/style/nsHTMLCSSStyleSheet.h b/layout/style/nsHTMLCSSStyleSheet.h index b3e8a16c6..25ea29f5a 100644 --- a/layout/style/nsHTMLCSSStyleSheet.h +++ b/layout/style/nsHTMLCSSStyleSheet.h @@ -11,6 +11,7 @@ #define nsHTMLCSSStyleSheet_h_ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsCOMPtr.h" #include "nsDataHashtable.h" @@ -39,9 +40,9 @@ public: virtual nsRestyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData) MOZ_OVERRIDE; virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) MOZ_OVERRIDE; - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue); diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index e91f71da6..e4b36310e 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -30,6 +30,7 @@ #include "nsError.h" #include "nsRuleProcessorData.h" #include "nsCSSRuleProcessor.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsCSSFrameConstructor.h" #include "nsHashKeys.h" @@ -372,13 +373,13 @@ nsHTMLStyleSheet::MediumFeaturesChanged(nsPresContext* aPresContext) } /* virtual */ size_t -nsHTMLStyleSheet::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsHTMLStyleSheet::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return 0; // nsHTMLStyleSheets are charged to the DOM, not layout } /* virtual */ size_t -nsHTMLStyleSheet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsHTMLStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return 0; // nsHTMLStyleSheets are charged to the DOM, not layout } @@ -527,7 +528,7 @@ nsHTMLStyleSheet::LangRuleFor(const nsString& aLanguage) static size_t SizeOfAttributesEntryExcludingThis(PLDHashEntryHdr* aEntry, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aArg) { NS_PRECONDITION(aEntry, "The entry should not be null!"); @@ -538,7 +539,7 @@ SizeOfAttributesEntryExcludingThis(PLDHashEntryHdr* aEntry, } size_t -nsHTMLStyleSheet::DOMSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsHTMLStyleSheet::DOMSizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h index 886745df6..9e5623a8e 100644 --- a/layout/style/nsHTMLStyleSheet.h +++ b/layout/style/nsHTMLStyleSheet.h @@ -20,6 +20,7 @@ #include "nsIStyleSheet.h" #include "pldhash.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsString.h" class nsMappedAttributes; @@ -45,11 +46,11 @@ public: virtual nsRestyleHint HasAttributeDependentStyle(AttributeRuleProcessorData* aData) MOZ_OVERRIDE; virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) MOZ_OVERRIDE; - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - size_t DOMSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t DOMSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; void Reset(); nsresult SetLinkColor(nscolor aColor); diff --git a/layout/style/nsIStyleRuleProcessor.h b/layout/style/nsIStyleRuleProcessor.h index f50aba4e7..67dbbf408 100644 --- a/layout/style/nsIStyleRuleProcessor.h +++ b/layout/style/nsIStyleRuleProcessor.h @@ -12,6 +12,7 @@ #ifndef nsIStyleRuleProcessor_h___ #define nsIStyleRuleProcessor_h___ +#include "mozilla/MemoryReporting.h" #include "nsISupports.h" #include "nsChangeHint.h" @@ -125,8 +126,8 @@ public: * Report the size of this style rule processor to about:memory. A * processor may return 0. */ - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) const = 0; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) const = 0; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const = 0; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleRuleProcessor, diff --git a/layout/style/nsIStyleSheet.h b/layout/style/nsIStyleSheet.h index 36a0a05e6..b61d9d5c8 100644 --- a/layout/style/nsIStyleSheet.h +++ b/layout/style/nsIStyleSheet.h @@ -11,6 +11,7 @@ #ifndef nsIStyleSheet_h___ #define nsIStyleSheet_h___ +#include "mozilla/MemoryReporting.h" #include #include "nsISupports.h" @@ -78,7 +79,7 @@ public: virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0; #endif - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheet, NS_ISTYLE_SHEET_IID) diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 0a49797f4..a4113c25c 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -6,6 +6,7 @@ #include "nsLayoutStylesheetCache.h" #include "nsAppDirectoryServiceDefs.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/css/Loader.h" #include "nsIFile.h" #include "nsIMemoryReporter.h" @@ -157,7 +158,7 @@ nsLayoutStylesheetCache::Shutdown() } size_t -nsLayoutStylesheetCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsLayoutStylesheetCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { if (!nsLayoutStylesheetCache::gStyleCache) { return 0; @@ -168,7 +169,7 @@ nsLayoutStylesheetCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) } size_t -nsLayoutStylesheetCache::SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const +nsLayoutStylesheetCache::SizeOfIncludingThisHelper(mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index 7a3ce99f4..61bdaffb8 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -9,6 +9,7 @@ #include "nsIObserver.h" #include "nsAutoPtr.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" class nsIFile; class nsCSSStyleSheet; @@ -38,7 +39,7 @@ class nsLayoutStylesheetCache MOZ_FINAL static void Shutdown(); - static size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + static size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: nsLayoutStylesheetCache(); @@ -50,7 +51,7 @@ private: static void LoadSheet(nsIURI* aURI, nsRefPtr &aSheet, bool aEnableUnsafeRules); - size_t SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThisHelper(mozilla::MallocSizeOf aMallocSizeOf) const; static nsLayoutStylesheetCache* gStyleCache; static mozilla::css::Loader* gCSSLoader; diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index f9ce6aa99..86af0dfd1 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -9,6 +9,7 @@ * potentially re-creating) style contexts */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "nsStyleSet.h" @@ -142,7 +143,7 @@ nsStyleSet::nsStyleSet() } size_t -nsStyleSet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsStyleSet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index 137235d73..9b322dc0d 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -13,6 +13,7 @@ #define nsStyleSet_h_ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsIStyleRuleProcessor.h" #include "nsCSSStyleSheet.h" @@ -70,7 +71,7 @@ class nsStyleSet public: nsStyleSet(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; void Init(nsPresContext *aPresContext); diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 00adbf3f4..46bd41317 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -11,6 +11,7 @@ #include "nsIContent.h" #include "nsStyleContext.h" #include "nsCSSProps.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "nsRefreshDriver.h" #include "nsRuleProcessorData.h" @@ -964,13 +965,13 @@ nsTransitionManager::RulesMatching(XULTreeRuleProcessorData* aData) #endif /* virtual */ size_t -nsTransitionManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsTransitionManager::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf); } /* virtual */ size_t -nsTransitionManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsTransitionManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 99e87865e..02f748b29 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -9,6 +9,7 @@ #define nsTransitionManager_h_ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "AnimationCommon.h" #include "nsCSSPseudoElements.h" @@ -170,9 +171,9 @@ public: #ifdef MOZ_XUL virtual void RulesMatching(XULTreeRuleProcessorData* aData) MOZ_OVERRIDE; #endif - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; // nsARefreshObserver diff --git a/memory/replace/dmd/DMD.cpp b/memory/replace/dmd/DMD.cpp index e8c973ecb..cc46d281c 100644 --- a/memory/replace/dmd/DMD.cpp +++ b/memory/replace/dmd/DMD.cpp @@ -34,6 +34,7 @@ #include "mozilla/Assertions.h" #include "mozilla/HashFunctions.h" #include "mozilla/Likely.h" +#include "mozilla/MemoryReporting.h" // MOZ_REPLACE_ONLY_MEMALIGN saves us from having to define // replace_{posix_memalign,aligned_alloc,valloc}. It requires defining @@ -1992,7 +1993,7 @@ PrintSortedTraceAndFrameRecords(const Writer& aWriter, } // Note that, unlike most SizeOf* functions, this function does not take a -// |nsMallocSizeOfFun| argument. That's because those arguments are primarily +// |mozilla::MallocSizeOf| argument. That's because those arguments are primarily // to aid DMD track heap blocks... but DMD deliberately doesn't track heap // blocks it allocated for itself! // diff --git a/mfbt/MemoryReporting.h b/mfbt/MemoryReporting.h new file mode 100644 index 000000000..65bc8b451 --- /dev/null +++ b/mfbt/MemoryReporting.h @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 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/. */ + +/* Memory reporting infrastructure. */ + +#ifndef mozilla_MemoryReporting_h_ +#define mozilla_MemoryReporting_h_ + +#include + +#ifdef __cplusplus + +namespace mozilla { + +/* + * This is for functions that are like malloc_usable_size. Such functions are + * used for measuring the size of data structures. + */ +typedef size_t (*MallocSizeOf)(const void* p); + +} /* namespace mozilla */ + +#endif /* __cplusplus */ + +typedef size_t (*MozMallocSizeOf)(const void* p); + +#endif /* mozilla_MemoryReporting_h_ */ diff --git a/mfbt/exported_headers.mk b/mfbt/exported_headers.mk index 40ad6b975..bf8301201 100644 --- a/mfbt/exported_headers.mk +++ b/mfbt/exported_headers.mk @@ -29,6 +29,7 @@ EXPORTS_mozilla += \ LinkedList.h \ MathAlgorithms.h \ MemoryChecking.h \ + MemoryReporting.h \ MSStdInt.h \ NullPtr.h \ PodOperations.h \ diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index 501abbb6e..1e4ef5821 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -3,6 +3,7 @@ * 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/MemoryReporting.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/Attributes.h" @@ -164,7 +165,7 @@ NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(PreferencesMallocSizeOf) static size_t SizeOfObserverEntryExcludingThis(ValueObserverHashKey* aKey, const nsRefPtr& aData, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void*) { size_t n = 0; diff --git a/modules/libpref/src/nsPrefBranch.h b/modules/libpref/src/nsPrefBranch.h index b58173611..539a12a37 100644 --- a/modules/libpref/src/nsPrefBranch.h +++ b/modules/libpref/src/nsPrefBranch.h @@ -21,6 +21,7 @@ #include "prbit.h" #include "nsTraceRefcnt.h" #include "mozilla/HashFunctions.h" +#include "mozilla/MemoryReporting.h" class nsPrefBranch; @@ -187,7 +188,7 @@ public: static nsresult NotifyObserver(const char *newpref, void *data); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); protected: nsPrefBranch() /* disallow use of this constructer */ diff --git a/modules/libpref/src/prefapi.cpp b/modules/libpref/src/prefapi.cpp index 26e688c61..d5ee95b92 100644 --- a/modules/libpref/src/prefapi.cpp +++ b/modules/libpref/src/prefapi.cpp @@ -23,6 +23,7 @@ #include "plbase64.h" #include "prlog.h" #include "prprf.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/PContent.h" #include "nsQuickSort.h" #include "nsString.h" @@ -799,7 +800,7 @@ nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t } size_t -pref_SizeOfPrivateData(nsMallocSizeOfFun aMallocSizeOf) +pref_SizeOfPrivateData(MallocSizeOf aMallocSizeOf) { size_t n = PL_SizeOfArenaPoolExcludingPool(&gPrefNameArena, aMallocSizeOf); for (struct CallbackNode* node = gCallbacks; node; node = node->next) { diff --git a/modules/libpref/src/prefapi_private_data.h b/modules/libpref/src/prefapi_private_data.h index 55f58005c..0a5f9b6f8 100644 --- a/modules/libpref/src/prefapi_private_data.h +++ b/modules/libpref/src/prefapi_private_data.h @@ -5,6 +5,8 @@ /* Data shared between prefapi.c and nsPref.cpp */ +#include "mozilla/MemoryReporting.h" + extern PLDHashTable gHashTable; extern bool gDirty; @@ -39,4 +41,4 @@ void pref_GetPrefFromEntry(PrefHashEntry *aHashEntry, mozilla::dom::PrefSetting* aPref); size_t -pref_SizeOfPrivateData(nsMallocSizeOfFun aMallocSizeOf); +pref_SizeOfPrivateData(mozilla::MallocSizeOf aMallocSizeOf); diff --git a/netwerk/base/src/nsSimpleURI.cpp b/netwerk/base/src/nsSimpleURI.cpp index 92fab862b..76bba9133 100644 --- a/netwerk/base/src/nsSimpleURI.cpp +++ b/netwerk/base/src/nsSimpleURI.cpp @@ -21,6 +21,7 @@ #include "nsError.h" #include "nsIProgrammingLanguage.h" #include "nsIIPCSerializableURI.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/ipc/URIUtils.h" using namespace mozilla::ipc; @@ -635,7 +636,7 @@ nsSimpleURI::SetMutable(bool value) //---------------------------------------------------------------------------- size_t -nsSimpleURI::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsSimpleURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + @@ -643,7 +644,7 @@ nsSimpleURI::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -nsSimpleURI::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { +nsSimpleURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/netwerk/base/src/nsSimpleURI.h b/netwerk/base/src/nsSimpleURI.h index 1c996332c..94bffab1d 100644 --- a/netwerk/base/src/nsSimpleURI.h +++ b/netwerk/base/src/nsSimpleURI.h @@ -6,6 +6,7 @@ #ifndef nsSimpleURI_h__ #define nsSimpleURI_h__ +#include "mozilla/MemoryReporting.h" #include "nsIURL.h" #include "nsAgg.h" #include "nsISerializable.h" @@ -50,8 +51,8 @@ public: // - nsJSURI: mBaseURI // - nsSimpleNestedURI: mInnerURI // - nsBlobURI: mPrincipal - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; protected: // enum used in a few places to specify how .ref attribute should be handled diff --git a/netwerk/base/src/nsStandardURL.cpp b/netwerk/base/src/nsStandardURL.cpp index 7e9f6a724..43fc1f566 100644 --- a/netwerk/base/src/nsStandardURL.cpp +++ b/netwerk/base/src/nsStandardURL.cpp @@ -23,6 +23,7 @@ #include "nsAutoPtr.h" #include "nsIProgrammingLanguage.h" #include "nsVoidArray.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/CheckedInt.h" #include @@ -3182,7 +3183,7 @@ nsStandardURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) //---------------------------------------------------------------------------- size_t -nsStandardURL::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +nsStandardURL::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return mSpec.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + mOriginCharset.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + @@ -3195,6 +3196,6 @@ nsStandardURL::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const } size_t -nsStandardURL::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { +nsStandardURL::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } diff --git a/netwerk/base/src/nsStandardURL.h b/netwerk/base/src/nsStandardURL.h index 14fba954a..a4c7175af 100644 --- a/netwerk/base/src/nsStandardURL.h +++ b/netwerk/base/src/nsStandardURL.h @@ -23,6 +23,7 @@ #include "nsISizeOf.h" #include "prclist.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsIIPCSerializableURI.h" #ifdef NS_BUILD_REFCNT_LOGGING @@ -58,8 +59,8 @@ public: NS_DECL_NSIIPCSERIALIZABLEURI // nsISizeOf - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; nsStandardURL(bool aSupportsFileURL = false); virtual ~nsStandardURL(); diff --git a/netwerk/cache/nsDiskCacheBinding.cpp b/netwerk/cache/nsDiskCacheBinding.cpp index 539443c97..2c9f71576 100644 --- a/netwerk/cache/nsDiskCacheBinding.cpp +++ b/netwerk/cache/nsDiskCacheBinding.cpp @@ -4,6 +4,7 @@ * 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/MemoryReporting.h" #include "nsCache.h" #include @@ -372,7 +373,7 @@ nsDiskCacheBindery::ActiveBindings() struct AccumulatorArg { size_t mUsage; - nsMallocSizeOfFun mMallocSizeOf; + mozilla::MallocSizeOf mMallocSizeOf; }; PLDHashOperator @@ -408,7 +409,7 @@ AccumulateHeapUsage(PLDHashTable *table, PLDHashEntryHdr *hdr, uint32_t number, * SizeOfExcludingThis: return the amount of heap memory (bytes) being used by the bindery */ size_t -nsDiskCacheBindery::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsDiskCacheBindery::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) { NS_ASSERTION(initialized, "nsDiskCacheBindery not initialized"); if (!initialized) return 0; diff --git a/netwerk/cache/nsDiskCacheBinding.h b/netwerk/cache/nsDiskCacheBinding.h index 7e607c384..0290a9487 100644 --- a/netwerk/cache/nsDiskCacheBinding.h +++ b/netwerk/cache/nsDiskCacheBinding.h @@ -8,6 +8,7 @@ #ifndef _nsDiskCacheBinding_h_ #define _nsDiskCacheBinding_h_ +#include "mozilla/MemoryReporting.h" #include "nspr.h" #include "pldhash.h" @@ -105,7 +106,7 @@ public: void RemoveBinding(nsDiskCacheBinding * binding); bool ActiveBindings(); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: nsresult AddBinding(nsDiskCacheBinding * binding); diff --git a/netwerk/cache/nsDiskCacheBlockFile.cpp b/netwerk/cache/nsDiskCacheBlockFile.cpp index 7d2a07533..6a1f4182f 100644 --- a/netwerk/cache/nsDiskCacheBlockFile.cpp +++ b/netwerk/cache/nsDiskCacheBlockFile.cpp @@ -8,6 +8,7 @@ #include "nsDiskCache.h" #include "nsDiskCacheBlockFile.h" #include "mozilla/FileUtils.h" +#include "mozilla/MemoryReporting.h" #include using namespace mozilla; @@ -397,7 +398,7 @@ nsDiskCacheBlockFile::Write(int32_t offset, const void *buf, int32_t amount) } size_t -nsDiskCacheBlockFile::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsDiskCacheBlockFile::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) { return aMallocSizeOf(mBitMap) + aMallocSizeOf(mFD); } diff --git a/netwerk/cache/nsDiskCacheBlockFile.h b/netwerk/cache/nsDiskCacheBlockFile.h index 5e5caa2e6..058cc7fcc 100644 --- a/netwerk/cache/nsDiskCacheBlockFile.h +++ b/netwerk/cache/nsDiskCacheBlockFile.h @@ -7,6 +7,7 @@ #ifndef _nsDiskCacheBlockFile_h_ #define _nsDiskCacheBlockFile_h_ +#include "mozilla/MemoryReporting.h" #include "nsIFile.h" #include "nsDiskCache.h" @@ -45,7 +46,7 @@ public: nsresult ReadBlocks( void * buffer, int32_t startBlock, int32_t numBlocks, int32_t * bytesRead); - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: nsresult FlushBitMap(); diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index db2dca61b..1f5f849a9 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -46,6 +46,7 @@ #include "nsISimpleEnumerator.h" #include "nsThreadUtils.h" +#include "mozilla/MemoryReporting.h" static const char DISK_CACHE_DEVICE_ID[] = { "disk" }; using namespace mozilla; @@ -1175,7 +1176,7 @@ nsDiskCacheDevice::SetMaxEntrySize(int32_t maxSizeInKilobytes) } size_t -nsDiskCacheDevice::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsDiskCacheDevice::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t usage = aMallocSizeOf(this); diff --git a/netwerk/cache/nsDiskCacheDevice.h b/netwerk/cache/nsDiskCacheDevice.h index 88f822314..803a62387 100644 --- a/netwerk/cache/nsDiskCacheDevice.h +++ b/netwerk/cache/nsDiskCacheDevice.h @@ -7,6 +7,7 @@ #ifndef _nsDiskCacheDevice_h_ #define _nsDiskCacheDevice_h_ +#include "mozilla/MemoryReporting.h" #include "nsCacheDevice.h" #include "nsDiskCacheBinding.h" #include "nsDiskCacheBlockFile.h" @@ -55,7 +56,7 @@ public: bool EntryIsTooBig(int64_t entrySize); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); /** * Preference accessors diff --git a/netwerk/cache/nsDiskCacheMap.cpp b/netwerk/cache/nsDiskCacheMap.cpp index 309a79b5f..ad9e59d36 100644 --- a/netwerk/cache/nsDiskCacheMap.cpp +++ b/netwerk/cache/nsDiskCacheMap.cpp @@ -17,6 +17,7 @@ #include "nsISerializable.h" #include "nsSerializationHelper.h" +#include "mozilla/MemoryReporting.h" #include using namespace mozilla; @@ -1213,7 +1214,7 @@ nsDiskCacheMap::NotifyCapacityChange(uint32_t capacity) } size_t -nsDiskCacheMap::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsDiskCacheMap::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) { size_t usage = aMallocSizeOf(mRecordArray); diff --git a/netwerk/cache/nsDiskCacheMap.h b/netwerk/cache/nsDiskCacheMap.h index 71ae9feb5..f1c5abe44 100644 --- a/netwerk/cache/nsDiskCacheMap.h +++ b/netwerk/cache/nsDiskCacheMap.h @@ -7,6 +7,7 @@ #ifndef _nsDiskCacheMap_h_ #define _nsDiskCacheMap_h_ +#include "mozilla/MemoryReporting.h" #include #include "prtypes.h" @@ -485,7 +486,7 @@ public: int32_t EntryCount() { return mHeader.mEntryCount; } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: diff --git a/netwerk/cache/nsDiskCacheStreams.cpp b/netwerk/cache/nsDiskCacheStreams.cpp index 89ada4c16..8e66b8b6c 100644 --- a/netwerk/cache/nsDiskCacheStreams.cpp +++ b/netwerk/cache/nsDiskCacheStreams.cpp @@ -12,6 +12,7 @@ #include "nsCacheService.h" #include "mozilla/FileUtils.h" #include "nsThreadUtils.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include @@ -599,7 +600,7 @@ nsDiskCacheStreamIO::DeleteBuffer() } size_t -nsDiskCacheStreamIO::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsDiskCacheStreamIO::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { size_t usage = aMallocSizeOf(this); diff --git a/netwerk/cache/nsDiskCacheStreams.h b/netwerk/cache/nsDiskCacheStreams.h index 2fbe2f0a8..f69b73384 100644 --- a/netwerk/cache/nsDiskCacheStreams.h +++ b/netwerk/cache/nsDiskCacheStreams.h @@ -8,6 +8,7 @@ #ifndef _nsDiskCacheStreams_h_ #define _nsDiskCacheStreams_h_ +#include "mozilla/MemoryReporting.h" #include "nsDiskCacheBinding.h" #include "nsCache.h" @@ -40,7 +41,7 @@ public: NS_ASSERTION(mInStreamCount >= 0, "mInStreamCount has gone negative"); } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); // GCC 2.95.2 requires this to be defined, although we never call it. // and OS/2 requires that it not be private diff --git a/netwerk/dns/nsEffectiveTLDService.cpp b/netwerk/dns/nsEffectiveTLDService.cpp index 328283e20..30ed008da 100644 --- a/netwerk/dns/nsEffectiveTLDService.cpp +++ b/netwerk/dns/nsEffectiveTLDService.cpp @@ -7,6 +7,7 @@ // complete description of the expected file format and parsing rules, see // http://wiki.mozilla.org/Gecko:Effective_TLD_Service +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "nsEffectiveTLDService.h" @@ -121,7 +122,7 @@ nsEffectiveTLDService::~nsEffectiveTLDService() } size_t -nsEffectiveTLDService::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsEffectiveTLDService::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = aMallocSizeOf(this); n += mHash.SizeOfExcludingThis(nullptr, aMallocSizeOf); diff --git a/netwerk/dns/nsEffectiveTLDService.h b/netwerk/dns/nsEffectiveTLDService.h index 731a62cea..edd38159a 100644 --- a/netwerk/dns/nsEffectiveTLDService.h +++ b/netwerk/dns/nsEffectiveTLDService.h @@ -9,6 +9,7 @@ #include "nsString.h" #include "nsCOMPtr.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" class nsIIDNService; class nsIMemoryReporter; @@ -110,7 +111,7 @@ public: nsEffectiveTLDService() { } nsresult Init(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: nsresult GetBaseDomainInternal(nsCString &aHostname, int32_t aAdditionalParts, nsACString &aBaseDomain); diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index e9372ada0..8d306f023 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -7,6 +7,7 @@ #include "prtypes.h" #include "pldhash.h" #include "nsXPCOMStrings.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/scache/StartupCache.h" #include "nsAutoPtr.h" @@ -363,7 +364,7 @@ StartupCache::SizeOfMapping() } size_t -StartupCache::HeapSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +StartupCache::HeapSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) { // This function could measure more members, but they haven't been found by // DMD to be significant. They can be added later if necessary. @@ -373,7 +374,7 @@ StartupCache::HeapSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) /* static */ size_t StartupCache::SizeOfEntryExcludingThis(const nsACString& key, const nsAutoPtr& data, - nsMallocSizeOfFun mallocSizeOf, void *) + mozilla::MallocSizeOf mallocSizeOf, void *) { return data->SizeOfExcludingThis(mallocSizeOf); } diff --git a/startupcache/StartupCache.h b/startupcache/StartupCache.h index ae51cfc32..e2f7a03b9 100644 --- a/startupcache/StartupCache.h +++ b/startupcache/StartupCache.h @@ -16,6 +16,7 @@ #include "nsIOutputStream.h" #include "nsIFile.h" #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" /** * The StartupCache is a persistent cache of simple key-value pairs, @@ -82,7 +83,7 @@ struct CacheEntry { } - size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(data); } }; @@ -129,7 +130,7 @@ public: // This measures all the heap memory used by the StartupCache, i.e. it // excludes the mapping. - size_t HeapSizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t HeapSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); size_t SizeOfMapping(); @@ -155,7 +156,7 @@ private: static size_t SizeOfEntryExcludingThis(const nsACString& key, const nsAutoPtr& data, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *); nsClassHashtable mTable; diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 7b28ccd99..3552f35bf 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -6,6 +6,7 @@ #include "mozilla/Attributes.h" #include "mozilla/DebugOnly.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/dom/ContentChild.h" @@ -2233,13 +2234,13 @@ History::FetchPageInfo(VisitData& _place, bool* _exists) } /* static */ size_t -History::SizeOfEntryExcludingThis(KeyClass* aEntry, nsMallocSizeOfFun aMallocSizeOf, void *) +History::SizeOfEntryExcludingThis(KeyClass* aEntry, mozilla::MallocSizeOf aMallocSizeOf, void *) { return aEntry->array.SizeOfExcludingThis(aMallocSizeOf); } size_t -History::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOfThis) +History::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOfThis) { return aMallocSizeOfThis(this) + mObservers.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOfThis); diff --git a/toolkit/components/places/History.h b/toolkit/components/places/History.h index 91197b9b3..5b96d1fe6 100644 --- a/toolkit/components/places/History.h +++ b/toolkit/components/places/History.h @@ -8,6 +8,7 @@ #define mozilla_places_History_h_ #include "mozilla/IHistory.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Mutex.h" #include "mozIAsyncHistory.h" #include "nsIDownloadHistory.h" @@ -82,7 +83,7 @@ public: * Get the number of bytes of memory this History object is using, * including sizeof(*this)) */ - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); /** * Obtains a pointer to this service. @@ -192,7 +193,7 @@ private: * SizeOfIncludingThis(). */ static size_t SizeOfEntryExcludingThis(KeyClass* aEntry, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void*); nsTHashtable mObservers; diff --git a/toolkit/components/places/tests/cpp/mock_Link.h b/toolkit/components/places/tests/cpp/mock_Link.h index 6ca54a953..d02a4314a 100644 --- a/toolkit/components/places/tests/cpp/mock_Link.h +++ b/toolkit/components/places/tests/cpp/mock_Link.h @@ -11,6 +11,7 @@ #ifndef mock_Link_h__ #define mock_Link_h__ +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/Link.h" class mock_Link : public mozilla::dom::Link @@ -41,7 +42,7 @@ public: mDeathGrip = 0; } - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return 0; // the value shouldn't matter } @@ -108,7 +109,7 @@ Link::GetURI() const } size_t -Link::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { NS_NOTREACHED("Unexpected call to Link::SizeOfExcludingThis"); return 0; diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp index d901aa9c3..12b91796b 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -16,6 +16,7 @@ #include "nsToolkitCompsCID.h" #include "nsTArray.h" #include "nsThreadUtils.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Mutex.h" #include "mozilla/FileUtils.h" #include "prlog.h" @@ -313,7 +314,7 @@ nsUrlClassifierPrefixSet::Contains(uint32_t aPrefix, bool* aFound) } size_t -nsUrlClassifierPrefixSet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsUrlClassifierPrefixSet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = 0; n += aMallocSizeOf(this); diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h index f6b0481b5..380f77d94 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h @@ -15,6 +15,7 @@ #include "nsIMemoryReporter.h" #include "nsTArray.h" #include "nsToolkitCompsCID.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Mutex.h" #include "mozilla/CondVar.h" #include "mozilla/FileUtils.h" @@ -39,7 +40,7 @@ public: // Return the estimated size of the set on disk and in memory, // in bytes - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf); protected: static const uint32_t DELTAS_LIMIT = 100; diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index e18e7aa34..23a9ce254 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -55,6 +55,7 @@ // traversed. #include "mozilla/CycleCollectedJSRuntime.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMJSClass.h" #include "jsfriendapi.h" @@ -482,7 +483,7 @@ CycleCollectedJSRuntime::~CycleCollectedJSRuntime() } size_t -CycleCollectedJSRuntime::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const +CycleCollectedJSRuntime::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index a53a7ce02..f179bd64c 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -7,6 +7,7 @@ #ifndef mozilla_CycleCollectedJSRuntime_h__ #define mozilla_CycleCollectedJSRuntime_h__ +#include "mozilla/MemoryReporting.h" #include "jsprvtd.h" #include "jsapi.h" @@ -88,7 +89,7 @@ protected: return mJSRuntime; } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; void UnmarkSkippableJSHolders(); virtual void TraverseAdditionalNativeRoots(nsCycleCollectionNoteRootCallback& aCb) = 0; diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 0039f2a0d..928826700 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -99,6 +99,7 @@ #include "base/process_util.h" /* This must occur *after* base/process_util.h to avoid typedefs conflicts. */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Util.h" #include "mozilla/CycleCollectedJSRuntime.h" @@ -384,7 +385,7 @@ public: Block **mNextBlockPtr; }; - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; Block *b = Blocks(); while (b) { @@ -581,7 +582,7 @@ public: PtrInfo *mNext, *mBlockEnd, *&mLast; }; - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { // We don't measure the things pointed to by mEntries[] because those // pointers are non-owning. size_t n = 0; @@ -622,7 +623,7 @@ struct GCGraph ~GCGraph() { } - void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, + void SizeOfExcludingThis(MallocSizeOf aMallocSizeOf, size_t *aNodesSize, size_t *aEdgesSize) const { *aNodesSize = mNodes.SizeOfExcludingThis(aMallocSizeOf); *aEdgesSize = mEdges.SizeOfExcludingThis(aMallocSizeOf); @@ -836,7 +837,7 @@ public: return mCount; } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = 0; @@ -1084,7 +1085,7 @@ public: mGraph.mRootCount = 0; } - void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, + void SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, size_t *aObjectSize, size_t *aGraphNodesSize, size_t *aGraphEdgesSize, @@ -2890,7 +2891,7 @@ nsCycleCollector::Shutdown() } void -nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, +nsCycleCollector::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf, size_t *aObjectSize, size_t *aGraphNodesSize, size_t *aGraphEdgesSize, diff --git a/xpcom/base/nsISizeOf.h b/xpcom/base/nsISizeOf.h index 258ec1827..35f5de44c 100644 --- a/xpcom/base/nsISizeOf.h +++ b/xpcom/base/nsISizeOf.h @@ -7,6 +7,7 @@ #ifndef nsISizeOf_h___ #define nsISizeOf_h___ +#include "mozilla/MemoryReporting.h" #include "nsISupports.h" #define NS_ISIZEOF_IID \ @@ -21,12 +22,12 @@ public: /** * Measures the size of the things pointed to by the object. */ - virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0; + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; /** * Like SizeOfExcludingThis, but also includes the size of the object itself. */ - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0; + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsISizeOf, NS_ISIZEOF_IID) diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index aa2e1c696..6e026699c 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -28,12 +28,6 @@ #include "mozilla/NullPtr.h" -/* - * This is for functions that are like malloc_usable_size. Such functions are - * used for measuring the size of data structures. - */ -typedef size_t(*nsMallocSizeOfFun)(const void *p); - /* Core XPCOM declarations. */ /*----------------------------------------------------------------------*/ diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp index 62e873c38..4d8536040 100644 --- a/xpcom/components/nsCategoryManager.cpp +++ b/xpcom/components/nsCategoryManager.cpp @@ -28,6 +28,7 @@ #include "nsQuickSort.h" #include "nsEnumeratorUtils.h" #include "nsThreadUtils.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Services.h" #include "ManifestParser.h" @@ -312,7 +313,7 @@ CategoryNode::Enumerate(nsISimpleEnumerator **_retval) } size_t -CategoryNode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) +CategoryNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) { // We don't measure the strings pointed to by the entries because the // pointers are non-owning. @@ -499,7 +500,7 @@ nsCategoryManager::GetCategoryManagerSize() static size_t SizeOfCategoryManagerTableEntryExcludingThis(nsDepCharHashKey::KeyType aKey, const nsAutoPtr &aData, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { // We don't measure the string pointed to by aKey because it's a non-owning @@ -508,7 +509,7 @@ SizeOfCategoryManagerTableEntryExcludingThis(nsDepCharHashKey::KeyType aKey, } size_t -nsCategoryManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsCategoryManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = aMallocSizeOf(this); diff --git a/xpcom/components/nsCategoryManager.h b/xpcom/components/nsCategoryManager.h index 6ac9a84bb..5f3e3efaa 100644 --- a/xpcom/components/nsCategoryManager.h +++ b/xpcom/components/nsCategoryManager.h @@ -11,6 +11,7 @@ #include "plarena.h" #include "nsClassHashtable.h" #include "nsICategoryManager.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Mutex.h" #include "mozilla/Attributes.h" @@ -76,7 +77,7 @@ public: ~CategoryNode(); void operator delete(void*) { } - size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: CategoryNode() @@ -122,7 +123,7 @@ public: static void Destroy(); static int64_t GetCategoryManagerSize(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: static nsCategoryManager* gCategoryManager; diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 4d8a474de..56e6da598 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -36,6 +36,7 @@ #include "nsCategoryManager.h" #include "nsCategoryManagerUtils.h" #include "xptiprivate.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/XPTInterfaceInfoManager.h" #include "nsIConsoleService.h" #include "nsIMemoryReporter.h" @@ -1697,7 +1698,7 @@ nsComponentManagerImpl::ContractIDToCID(const char *aContractID, static size_t SizeOfFactoriesEntryExcludingThis(nsIDHashKey::KeyType aKey, nsFactoryEntry* const &aData, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { return aData->SizeOfIncludingThis(aMallocSizeOf); @@ -1706,7 +1707,7 @@ SizeOfFactoriesEntryExcludingThis(nsIDHashKey::KeyType aKey, static size_t SizeOfContractIDsEntryExcludingThis(nsCStringHashKey::KeyType aKey, nsFactoryEntry* const &aData, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aUserArg) { // We don't measure the nsFactoryEntry data because its owned by mFactories @@ -1715,7 +1716,7 @@ SizeOfContractIDsEntryExcludingThis(nsCStringHashKey::KeyType aKey, } size_t -nsComponentManagerImpl::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsComponentManagerImpl::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = aMallocSizeOf(this); n += mLoaderMap.SizeOfExcludingThis(nullptr, aMallocSizeOf); @@ -1819,7 +1820,7 @@ nsFactoryEntry::GetFactory() } size_t -nsFactoryEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +nsFactoryEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = aMallocSizeOf(this); diff --git a/xpcom/components/nsComponentManager.h b/xpcom/components/nsComponentManager.h index a5c96097d..be605ac72 100644 --- a/xpcom/components/nsComponentManager.h +++ b/xpcom/components/nsComponentManager.h @@ -13,6 +13,7 @@ #include "nsIComponentRegistrar.h" #include "nsIServiceManager.h" #include "nsIFile.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Module.h" #include "mozilla/ModuleLoader.h" #include "mozilla/Mutex.h" @@ -311,7 +312,7 @@ public: nsTArray mPendingServices; - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); private: ~nsComponentManagerImpl(); @@ -336,7 +337,7 @@ struct nsFactoryEntry already_AddRefed GetFactory(); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); const mozilla::Module::CIDEntry* mCIDEntry; nsComponentManagerImpl::KnownModule* mModule; diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index e78c6dd32..529c96e52 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -7,6 +7,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/HashFunctions.h" +#include "mozilla/MemoryReporting.h" #include "nsAtomTable.h" #include "nsStaticAtom.h" @@ -96,7 +97,7 @@ public: // for |#ifdef NS_BUILD_REFCNT_LOGGING| access to reference count nsrefcnt GetRefCount() { return mRefCnt; } - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; }; /** @@ -435,7 +436,7 @@ AtomImpl::IsStaticAtom() } size_t -AtomImpl::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const +AtomImpl::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + nsStringBuffer::FromData(mString)-> @@ -446,7 +447,7 @@ AtomImpl::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const static size_t SizeOfAtomTableEntryExcludingThis(PLDHashEntryHdr *aHdr, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void *aArg) { AtomTableEntry* entry = static_cast(aHdr); @@ -456,14 +457,14 @@ SizeOfAtomTableEntryExcludingThis(PLDHashEntryHdr *aHdr, static size_t SizeOfStaticAtomTableEntryExcludingThis(const nsAString& aKey, nsIAtom* const& aData, - nsMallocSizeOfFun aMallocSizeOf, + MallocSizeOf aMallocSizeOf, void* aArg) { return aKey.SizeOfExcludingThisIfUnshared(aMallocSizeOf); } size_t -NS_SizeOfAtomTablesIncludingThis(nsMallocSizeOfFun aMallocSizeOf) { +NS_SizeOfAtomTablesIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = 0; if (gAtomTable.ops) { n += PL_DHashTableSizeOfExcludingThis(&gAtomTable, diff --git a/xpcom/ds/nsAtomTable.h b/xpcom/ds/nsAtomTable.h index 30b1f9e55..0f9244cff 100644 --- a/xpcom/ds/nsAtomTable.h +++ b/xpcom/ds/nsAtomTable.h @@ -6,11 +6,12 @@ #ifndef nsAtomTable_h__ #define nsAtomTable_h__ +#include "mozilla/MemoryReporting.h" #include #include "nscore.h" void NS_PurgeAtomTable(); -size_t NS_SizeOfAtomTablesIncludingThis(nsMallocSizeOfFun aMallocSizeOf); +size_t NS_SizeOfAtomTablesIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); #endif // nsAtomTable_h__ diff --git a/xpcom/glue/nsBaseHashtable.h b/xpcom/glue/nsBaseHashtable.h index 7c2fbb02e..126ff8021 100644 --- a/xpcom/glue/nsBaseHashtable.h +++ b/xpcom/glue/nsBaseHashtable.h @@ -6,6 +6,7 @@ #ifndef nsBaseHashtable_h__ #define nsBaseHashtable_h__ +#include "mozilla/MemoryReporting.h" #include "nsTHashtable.h" #include "prlock.h" #include "nsDebug.h" @@ -240,7 +241,7 @@ public: typedef size_t (* SizeOfEntryExcludingThisFun)(KeyType aKey, const DataType &aData, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void* userArg); /** @@ -256,7 +257,7 @@ public: * @return the summed size of the entries, the table, and the table's storage */ size_t SizeOfIncludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, void *userArg = nullptr) + mozilla::MallocSizeOf mallocSizeOf, void *userArg = nullptr) { return mallocSizeOf(this) + this->SizeOfExcludingThis(sizeOfEntryExcludingThis, mallocSizeOf, userArg); @@ -275,7 +276,7 @@ public: * @return the summed size of all the entries */ size_t SizeOfExcludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, void *userArg = nullptr) const + mozilla::MallocSizeOf mallocSizeOf, void *userArg = nullptr) const { if (!IsInitialized()) { return 0; @@ -323,7 +324,7 @@ protected: }; static size_t s_SizeOfStub(PLDHashEntryHdr *entry, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg); }; @@ -457,7 +458,7 @@ nsBaseHashtable::s_EnumStub template size_t nsBaseHashtable::s_SizeOfStub - (PLDHashEntryHdr *hdr, nsMallocSizeOfFun mallocSizeOf, void *arg) + (PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *arg) { EntryType* ent = static_cast(hdr); s_SizeOfArgs* eargs = static_cast(arg); diff --git a/xpcom/glue/nsCOMArray.cpp b/xpcom/glue/nsCOMArray.cpp index 32941fca3..99b1b5e48 100644 --- a/xpcom/glue/nsCOMArray.cpp +++ b/xpcom/glue/nsCOMArray.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsCOMArray.h" + +#include "mozilla/MemoryReporting.h" + #include "nsCOMPtr.h" // This specialization is private to nsCOMArray. @@ -264,7 +267,7 @@ nsCOMArray_base::SetCount(int32_t aNewCount) size_t nsCOMArray_base::SizeOfExcludingThis( nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, - nsMallocSizeOfFun aMallocSizeOf, void* aData) const + mozilla::MallocSizeOf aMallocSizeOf, void* aData) const { size_t n = mArray.SizeOfExcludingThis(aMallocSizeOf); diff --git a/xpcom/glue/nsCOMArray.h b/xpcom/glue/nsCOMArray.h index 0d9dd05fc..f1c66788c 100644 --- a/xpcom/glue/nsCOMArray.h +++ b/xpcom/glue/nsCOMArray.h @@ -7,6 +7,7 @@ #define nsCOMArray_h__ #include "mozilla/Attributes.h" +#include "mozilla/MemoryReporting.h" #include "nsCycleCollectionNoteChild.h" #include "nsTArray.h" @@ -161,14 +162,14 @@ public: } typedef size_t (* nsBaseArraySizeOfElementIncludingThisFunc) - (nsISupports* aElement, nsMallocSizeOfFun aMallocSizeOf, void *aData); + (nsISupports* aElement, mozilla::MallocSizeOf aMallocSizeOf, void *aData); // Measures the size of the array's element storage, and if // |aSizeOfElement| is non-NULL, measures the size of things pointed to by // elements. size_t SizeOfExcludingThis( nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, - nsMallocSizeOfFun aMallocSizeOf, void* aData = NULL) const; + mozilla::MallocSizeOf aMallocSizeOf, void* aData = NULL) const; private: @@ -376,11 +377,11 @@ class nsCOMArray : public nsCOMArray_base // "IncludingThis" rather than "ExcludingThis" because it needs to measure // the memory taken by the T itself as well as anything it points to. typedef size_t (* nsCOMArraySizeOfElementIncludingThisFunc) - (T* aElement, nsMallocSizeOfFun aMallocSizeOf, void *aData); + (T* aElement, mozilla::MallocSizeOf aMallocSizeOf, void *aData); size_t SizeOfExcludingThis( nsCOMArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, - nsMallocSizeOfFun aMallocSizeOf, void *aData = NULL) const { + mozilla::MallocSizeOf aMallocSizeOf, void *aData = NULL) const { return nsCOMArray_base::SizeOfExcludingThis( nsBaseArraySizeOfElementIncludingThisFunc(aSizeOfElementIncludingThis), aMallocSizeOf, aData); diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 7aad24841..6bc0c82e1 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -9,6 +9,7 @@ #include "nsTArrayForwardDeclare.h" #include "mozilla/Assertions.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/TypeTraits.h" #include "mozilla/Util.h" @@ -833,7 +834,7 @@ public: // @return The amount of memory used by this nsTArray_Impl, excluding // sizeof(*this). - size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) const { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { if (this->UsesAutoArrayBuffer() || Hdr() == EmptyHdr()) return 0; return mallocSizeOf(this->Hdr()); @@ -841,7 +842,7 @@ public: // @return The amount of memory used by this nsTArray_Impl, including // sizeof(*this). - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) const { + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + SizeOfExcludingThis(mallocSizeOf); } diff --git a/xpcom/glue/nsTHashtable.h b/xpcom/glue/nsTHashtable.h index 72ffcde6c..53fb8167d 100644 --- a/xpcom/glue/nsTHashtable.h +++ b/xpcom/glue/nsTHashtable.h @@ -10,6 +10,7 @@ #include "pldhash.h" #include "nsDebug.h" #include NEW_H +#include "mozilla/MemoryReporting.h" #include "mozilla/fallible.h" // helper function for nsTHashtable::Clear() @@ -256,7 +257,7 @@ public: * @return summed size of the things pointed to by the entries */ typedef size_t (* SizeOfEntryExcludingThisFun)(EntryType* aEntry, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg); /** @@ -272,7 +273,7 @@ public: * @return the summed size of all the entries */ size_t SizeOfExcludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, void *userArg = NULL) const + mozilla::MallocSizeOf mallocSizeOf, void *userArg = NULL) const { if (!IsInitialized()) { return 0; @@ -355,7 +356,7 @@ protected: }; static size_t s_SizeOfStub(PLDHashEntryHdr *entry, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg); private: @@ -489,7 +490,7 @@ nsTHashtable::s_EnumStub(PLDHashTable *table, template size_t nsTHashtable::s_SizeOfStub(PLDHashEntryHdr *entry, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg) { // dereferences the function-pointer to the user's enumeration function diff --git a/xpcom/glue/nsTObserverArray.h b/xpcom/glue/nsTObserverArray.h index eb862f33f..92dc9d0e1 100644 --- a/xpcom/glue/nsTObserverArray.h +++ b/xpcom/glue/nsTObserverArray.h @@ -6,6 +6,7 @@ #ifndef nsTObserverArray_h___ #define nsTObserverArray_h___ +#include "mozilla/MemoryReporting.h" #include "nsTArray.h" #include "nsCycleCollectionNoteChild.h" @@ -243,7 +244,7 @@ class nsAutoTObserverArray : protected nsTObserverArray_base { // Returns the number of bytes on the heap taken up by this object, not // including sizeof(*this). - size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) const { + size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { return mArray.SizeOfExcludingThis(mallocSizeOf); } diff --git a/xpcom/glue/nsVoidArray.cpp b/xpcom/glue/nsVoidArray.cpp index 60bddbfc7..02f4e1385 100644 --- a/xpcom/glue/nsVoidArray.cpp +++ b/xpcom/glue/nsVoidArray.cpp @@ -3,6 +3,7 @@ * 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/MemoryReporting.h" #include #include "nsVoidArray.h" @@ -697,7 +698,7 @@ struct SizeOfElementIncludingThisData { size_t mSize; nsVoidArraySizeOfElementIncludingThisFunc mSizeOfElementIncludingThis; - nsMallocSizeOfFun mMallocSizeOf; + mozilla::MallocSizeOf mMallocSizeOf; void *mData; // the arg passed by the user }; @@ -712,7 +713,7 @@ SizeOfElementIncludingThisEnumerator(const void *aElement, void *aData) size_t nsVoidArray::SizeOfExcludingThis( nsVoidArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, - nsMallocSizeOfFun aMallocSizeOf, void* aData) const + mozilla::MallocSizeOf aMallocSizeOf, void* aData) const { size_t n = 0; // Measure the element storage. diff --git a/xpcom/glue/nsVoidArray.h b/xpcom/glue/nsVoidArray.h index 78193bc50..310095b71 100644 --- a/xpcom/glue/nsVoidArray.h +++ b/xpcom/glue/nsVoidArray.h @@ -9,6 +9,7 @@ #include "nsDebug.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/StandardInteger.h" // Comparator callback function for sorting array values. @@ -21,7 +22,7 @@ typedef bool (* nsVoidArrayEnumFuncConst)(const void* aElement, void *aData); // SizeOfExcludingThis callback function. typedef size_t (* nsVoidArraySizeOfElementIncludingThisFunc)(const void* aElement, - nsMallocSizeOfFun aMallocSizeOf, + mozilla::MallocSizeOf aMallocSizeOf, void *aData); /// A basic zero-based array of void*'s that manages its own memory @@ -111,7 +112,7 @@ public: // pointed to by elements. size_t SizeOfExcludingThis( nsVoidArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, - nsMallocSizeOfFun aMallocSizeOf, void* aData = NULL) const; + mozilla::MallocSizeOf aMallocSizeOf, void* aData = NULL) const; protected: bool GrowArrayBy(int32_t aGrowBy); diff --git a/xpcom/glue/pldhash.cpp b/xpcom/glue/pldhash.cpp index 4357dfaea..9f4010a8b 100644 --- a/xpcom/glue/pldhash.cpp +++ b/xpcom/glue/pldhash.cpp @@ -15,6 +15,7 @@ #include "nsDebug.h" /* for PR_ASSERT */ #include "nsAlgorithm.h" #include "mozilla/Likely.h" +#include "mozilla/MemoryReporting.h" #ifdef PL_DHASHMETER # if defined MOZILLA_CLIENT && defined DEBUG_XXXbrendan @@ -755,7 +756,7 @@ struct SizeOfEntryExcludingThisArg { size_t total; PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis; - nsMallocSizeOfFun mallocSizeOf; + MallocSizeOf mallocSizeOf; void *arg; // the arg passed by the user }; @@ -771,7 +772,7 @@ SizeOfEntryExcludingThisEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr, size_t PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, + MallocSizeOf mallocSizeOf, void *arg /* = NULL */) { size_t n = 0; @@ -788,7 +789,7 @@ PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table, size_t PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, + MallocSizeOf mallocSizeOf, void *arg /* = NULL */) { return mallocSizeOf(table) + diff --git a/xpcom/glue/pldhash.h b/xpcom/glue/pldhash.h index c5fa69a0b..6eb34861b 100644 --- a/xpcom/glue/pldhash.h +++ b/xpcom/glue/pldhash.h @@ -8,6 +8,7 @@ /* * Double hashing, a la Knuth 6. */ +#include "mozilla/MemoryReporting.h" #include "mozilla/Types.h" #include "nscore.h" @@ -549,7 +550,7 @@ PL_DHashTableEnumerate(PLDHashTable *table, PLDHashEnumerator etor, void *arg); typedef size_t (* PLDHashSizeOfEntryExcludingThisFun)(PLDHashEntryHdr *hdr, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg); /** @@ -561,7 +562,7 @@ typedef size_t NS_COM_GLUE size_t PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg = NULL); /** @@ -570,7 +571,7 @@ PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table, NS_COM_GLUE size_t PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, - nsMallocSizeOfFun mallocSizeOf, + mozilla::MallocSizeOf mallocSizeOf, void *arg = NULL); #ifdef DEBUG diff --git a/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h b/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h index 1fddf395f..4876e03ea 100644 --- a/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h +++ b/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h @@ -9,6 +9,7 @@ #include "nsIInterfaceInfoManager.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/Mutex.h" #include "mozilla/ReentrantMonitor.h" #include "nsDataHashtable.h" @@ -44,7 +45,7 @@ public: xptiInterfaceEntry* GetInterfaceEntryForIID(const nsIID *iid); - size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); static int64_t GetXPTIWorkingSetSize(); diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 771f034d7..39c5904fc 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -5,6 +5,7 @@ /* Implementation of xptiInterfaceInfoManager. */ +#include "mozilla/MemoryReporting.h" #include "mozilla/XPTInterfaceInfoManager.h" #include "xptiprivate.h" @@ -30,7 +31,7 @@ static int gCallCount = 0; NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(XPTMallocSizeOf) size_t -XPTInterfaceInfoManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) +XPTInterfaceInfoManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) { size_t n = aMallocSizeOf(this); ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor); diff --git a/xpcom/string/public/nsStringBuffer.h b/xpcom/string/public/nsStringBuffer.h index be0cc3da0..dbd927598 100644 --- a/xpcom/string/public/nsStringBuffer.h +++ b/xpcom/string/public/nsStringBuffer.h @@ -7,6 +7,8 @@ #ifndef nsStringBuffer_h__ #define nsStringBuffer_h__ +#include "mozilla/MemoryReporting.h" + template struct already_AddRefed; /** @@ -143,12 +145,12 @@ class nsStringBuffer * This measures the size. It should only be used if the StringBuffer is * unshared. This is checked. */ - size_t SizeOfIncludingThisMustBeUnshared(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf) const; /** * This measures the size only if the StringBuffer is unshared. */ - size_t SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const; /** * This measures the size regardless of whether the StringBuffer is @@ -159,7 +161,7 @@ class nsStringBuffer * please explain clearly in a comment why it's safe and won't lead to * double-counting. */ - size_t SizeOfIncludingThisEvenIfShared(nsMallocSizeOfFun aMallocSizeOf) const; + size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf) const; }; #endif /* !defined(nsStringBuffer_h__ */ diff --git a/xpcom/string/public/nsTSubstring.h b/xpcom/string/public/nsTSubstring.h index d9d8bcb9c..7b92d7fa5 100644 --- a/xpcom/string/public/nsTSubstring.h +++ b/xpcom/string/public/nsTSubstring.h @@ -6,6 +6,7 @@ // IWYU pragma: private, include "nsAString.h" +#include "mozilla/MemoryReporting.h" #include "mozilla/CheckedInt.h" #ifndef MOZILLA_INTERNAL_API @@ -628,14 +629,14 @@ class nsTSubstring_CharT mFlags(flags) {} #endif /* DEBUG || FORCE_BUILD_REFCNT_LOGGING */ - size_t SizeOfExcludingThisMustBeUnshared(nsMallocSizeOfFun mallocSizeOf) + size_t SizeOfExcludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf) const; - size_t SizeOfIncludingThisMustBeUnshared(nsMallocSizeOfFun mallocSizeOf) + size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf) const; - size_t SizeOfExcludingThisIfUnshared(nsMallocSizeOfFun mallocSizeOf) + size_t SizeOfExcludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf) const; - size_t SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun mallocSizeOf) + size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf) const; /** @@ -644,9 +645,9 @@ class nsTSubstring_CharT * you do use them, please explain clearly in a comment why it's safe * and won't lead to double-counting. */ - size_t SizeOfExcludingThisEvenIfShared(nsMallocSizeOfFun mallocSizeOf) + size_t SizeOfExcludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf) const; - size_t SizeOfIncludingThisEvenIfShared(nsMallocSizeOfFun mallocSizeOf) + size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf) const; protected: diff --git a/xpcom/string/src/nsSubstring.cpp b/xpcom/string/src/nsSubstring.cpp index fe1c22755..ee6ca120c 100644 --- a/xpcom/string/src/nsSubstring.cpp +++ b/xpcom/string/src/nsSubstring.cpp @@ -8,6 +8,8 @@ #define ENABLE_STRING_STATS #endif +#include "mozilla/MemoryReporting.h" + #ifdef ENABLE_STRING_STATS #include #endif @@ -277,7 +279,7 @@ nsStringBuffer::ToString(uint32_t len, nsACString &str, } size_t -nsStringBuffer::SizeOfIncludingThisMustBeUnshared(nsMallocSizeOfFun aMallocSizeOf) const +nsStringBuffer::SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf) const { NS_ASSERTION(!IsReadonly(), "shared StringBuffer in SizeOfIncludingThisMustBeUnshared"); @@ -285,7 +287,7 @@ nsStringBuffer::SizeOfIncludingThisMustBeUnshared(nsMallocSizeOfFun aMallocSizeO } size_t -nsStringBuffer::SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun aMallocSizeOf) const +nsStringBuffer::SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const { if (!IsReadonly()) { @@ -295,7 +297,7 @@ nsStringBuffer::SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun aMallocSizeOf) c } size_t -nsStringBuffer::SizeOfIncludingThisEvenIfShared(nsMallocSizeOfFun aMallocSizeOf) const +nsStringBuffer::SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); } diff --git a/xpcom/string/src/nsTSubstring.cpp b/xpcom/string/src/nsTSubstring.cpp index d9d078d21..4acfb87b9 100644 --- a/xpcom/string/src/nsTSubstring.cpp +++ b/xpcom/string/src/nsTSubstring.cpp @@ -3,6 +3,7 @@ /* 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/MemoryReporting.h" #include "prdtoa.h" #ifdef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE @@ -883,7 +884,7 @@ nsTSubstring_CharT::DoAppendFloat( double aFloat, int digits ) size_t nsTSubstring_CharT::SizeOfExcludingThisMustBeUnshared( - nsMallocSizeOfFun mallocSizeOf) const + mozilla::MallocSizeOf mallocSizeOf) const { if (mFlags & F_SHARED) { return nsStringBuffer::FromData(mData)-> @@ -906,7 +907,7 @@ nsTSubstring_CharT::SizeOfExcludingThisMustBeUnshared( size_t nsTSubstring_CharT::SizeOfExcludingThisIfUnshared( - nsMallocSizeOfFun mallocSizeOf) const + mozilla::MallocSizeOf mallocSizeOf) const { // This is identical to SizeOfExcludingThisMustBeUnshared except for the // F_SHARED case. @@ -922,7 +923,7 @@ nsTSubstring_CharT::SizeOfExcludingThisIfUnshared( size_t nsTSubstring_CharT::SizeOfExcludingThisEvenIfShared( - nsMallocSizeOfFun mallocSizeOf) const + mozilla::MallocSizeOf mallocSizeOf) const { // This is identical to SizeOfExcludingThisMustBeUnshared except for the // F_SHARED case. @@ -938,21 +939,21 @@ nsTSubstring_CharT::SizeOfExcludingThisEvenIfShared( size_t nsTSubstring_CharT::SizeOfIncludingThisMustBeUnshared( - nsMallocSizeOfFun mallocSizeOf) const + mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + SizeOfExcludingThisMustBeUnshared(mallocSizeOf); } size_t nsTSubstring_CharT::SizeOfIncludingThisIfUnshared( - nsMallocSizeOfFun mallocSizeOf) const + mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + SizeOfExcludingThisIfUnshared(mallocSizeOf); } size_t nsTSubstring_CharT::SizeOfIncludingThisEvenIfShared( - nsMallocSizeOfFun mallocSizeOf) const + mozilla::MallocSizeOf mallocSizeOf) const { return mallocSizeOf(this) + SizeOfExcludingThisEvenIfShared(mallocSizeOf); } diff --git a/xpcom/typelib/xpt/public/xpt_arena.h b/xpcom/typelib/xpt/public/xpt_arena.h index c4f208806..1192aada7 100644 --- a/xpcom/typelib/xpt/public/xpt_arena.h +++ b/xpcom/typelib/xpt/public/xpt_arena.h @@ -12,6 +12,7 @@ #include "prtypes.h" #include +#include "mozilla/MemoryReporting.h" #include "mozilla/StandardInteger.h" @@ -53,11 +54,8 @@ XPT_NotifyDoneLoading(XPTArena *arena); XPT_PUBLIC_API(void) XPT_ArenaFree(XPTArena *arena, void* block); -/* A synonym of |nsMallocSizeOfFun|, because we don't #include nscore.h. */ -typedef size_t(*xptMallocSizeOfFun)(const void *p); - XPT_PUBLIC_API(size_t) -XPT_SizeOfArena(XPTArena *arena, xptMallocSizeOfFun mallocSizeOf); +XPT_SizeOfArena(XPTArena *arena, MozMallocSizeOf mallocSizeOf); /* --------------------------------------------------------- */ diff --git a/xpcom/typelib/xpt/src/xpt_arena.c b/xpcom/typelib/xpt/src/xpt_arena.c index 8efaa08b5..c4bb161c5 100644 --- a/xpcom/typelib/xpt/src/xpt_arena.c +++ b/xpcom/typelib/xpt/src/xpt_arena.c @@ -12,6 +12,7 @@ */ #include "xpt_arena.h" +#include "mozilla/MemoryReporting.h" #include #include #include @@ -306,7 +307,7 @@ XPT_AssertFailed(const char *s, const char *file, uint32_t lineno) #endif XPT_PUBLIC_API(size_t) -XPT_SizeOfArena(XPTArena *arena, xptMallocSizeOfFun mallocSizeOf) +XPT_SizeOfArena(XPTArena *arena, MozMallocSizeOf mallocSizeOf) { size_t n = mallocSizeOf(arena);