зеркало из https://github.com/mozilla/gecko-dev.git
Bug 682431 (part 2) - Add memory reporters for URIs and Links. r=biesi,bz,jlebar.
--HG-- extra : rebase_source : db4f094a7d334914b986bb66f5bf1089aafda561
This commit is contained in:
Родитель
b6e9c4d7bb
Коммит
3b808f9c61
|
@ -67,11 +67,12 @@ NS_IMPL_THREADSAFE_ADDREF(nsNullPrincipalURI)
|
||||||
NS_IMPL_THREADSAFE_RELEASE(nsNullPrincipalURI)
|
NS_IMPL_THREADSAFE_RELEASE(nsNullPrincipalURI)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI)
|
NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURI)
|
||||||
if (aIID.Equals(kNullPrincipalURIImplementationCID))
|
if (aIID.Equals(kNullPrincipalURIImplementationCID))
|
||||||
foundInterface = static_cast<nsIURI *>(this);
|
foundInterface = static_cast<nsIURI *>(this);
|
||||||
else
|
else
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIURI)
|
NS_INTERFACE_MAP_ENTRY(nsIURI)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -299,3 +300,19 @@ nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
|
||||||
*_schemeIs = (0 == nsCRT::strcasecmp(mScheme.get(), aScheme));
|
*_schemeIs = (0 == nsCRT::strcasecmp(mScheme.get(), aScheme));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//// nsISizeOf
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsNullPrincipalURI::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
|
||||||
|
mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsNullPrincipalURI::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
|
||||||
|
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#define __nsNullPrincipalURI_h__
|
#define __nsNullPrincipalURI_h__
|
||||||
|
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
#include "nsISizeOf.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
|
@ -54,11 +55,16 @@
|
||||||
{0xb9, 0x1b, 0x6b, 0x54, 0x10, 0x22, 0x36, 0xe6} }
|
{0xb9, 0x1b, 0x6b, 0x54, 0x10, 0x22, 0x36, 0xe6} }
|
||||||
|
|
||||||
class nsNullPrincipalURI : public nsIURI
|
class nsNullPrincipalURI : public nsIURI
|
||||||
|
, public nsISizeOf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIURI
|
NS_DECL_NSIURI
|
||||||
|
|
||||||
|
// nsISizeOf
|
||||||
|
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
|
||||||
nsNullPrincipalURI(const nsCString &aSpec);
|
nsNullPrincipalURI(const nsCString &aSpec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include "nsEventStates.h"
|
#include "nsEventStates.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
|
#include "nsISizeOf.h"
|
||||||
|
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
|
@ -531,5 +532,24 @@ Link::SetHrefAttribute(nsIURI *aURI)
|
||||||
NS_ConvertUTF8toUTF16(href), true);
|
NS_ConvertUTF8toUTF16(href), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
Link::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
size_t n = 0;
|
||||||
|
|
||||||
|
if (mCachedURI) {
|
||||||
|
nsCOMPtr<nsISizeOf> iface = do_QueryInterface(mCachedURI);
|
||||||
|
if (iface) {
|
||||||
|
n += iface->SizeOfIncludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following members don't need to be measured:
|
||||||
|
// - mElement, because it is a pointer-to-self used to avoid QIs
|
||||||
|
// - mHistory, because it is non-owning
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -131,6 +131,9 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool HasDeferredDNSPrefetchRequest() { return true; }
|
virtual bool HasDeferredDNSPrefetchRequest() { return true; }
|
||||||
|
|
||||||
|
virtual size_t
|
||||||
|
SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Link();
|
virtual ~Link();
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ public:
|
||||||
// nsIDOMHTMLAnchorElement
|
// nsIDOMHTMLAnchorElement
|
||||||
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
||||||
|
|
||||||
// TODO: nsHTMLAnchorElement::SizeOfAnchorElement should call
|
// DOM memory reporter participant
|
||||||
// Link::SizeOfExcludingThis(). See bug 682431.
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||||
|
|
||||||
// nsILink
|
// nsILink
|
||||||
NS_IMETHOD LinkAdded() { return NS_OK; }
|
NS_IMETHOD LinkAdded() { return NS_OK; }
|
||||||
|
@ -520,3 +520,10 @@ nsHTMLAnchorElement::IntrinsicState() const
|
||||||
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsHTMLAnchorElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
|
||||||
|
Link::SizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ public:
|
||||||
// nsISupports
|
// nsISupports
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// TODO: nsHTMLAreaElement::SizeOfAnchorElement should call
|
// DOM memory reporter participant
|
||||||
// Link::SizeOfExcludingThis(). See bug 682431.
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
|
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
|
||||||
|
@ -335,3 +335,11 @@ nsHTMLAreaElement::IntrinsicState() const
|
||||||
{
|
{
|
||||||
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsHTMLAreaElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
|
||||||
|
Link::SizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ public:
|
||||||
// nsIDOMHTMLLinkElement
|
// nsIDOMHTMLLinkElement
|
||||||
NS_DECL_NSIDOMHTMLLINKELEMENT
|
NS_DECL_NSIDOMHTMLLINKELEMENT
|
||||||
|
|
||||||
// TODO: nsHTMLLinkElement::SizeOfAnchorElement should call
|
// DOM memory reporter participant
|
||||||
// Link::SizeOfExcludingThis(). See bug 682431.
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||||
|
|
||||||
// nsILink
|
// nsILink
|
||||||
NS_IMETHOD LinkAdded();
|
NS_IMETHOD LinkAdded();
|
||||||
|
@ -458,3 +458,11 @@ nsHTMLLinkElement::IntrinsicState() const
|
||||||
{
|
{
|
||||||
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsHTMLLinkElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
|
||||||
|
Link::SizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS2(nsMozIconURI, nsIMozIconURI, nsIURI)
|
||||||
#define MOZICON_SCHEME_LEN (sizeof(MOZICON_SCHEME) - 1)
|
#define MOZICON_SCHEME_LEN (sizeof(MOZICON_SCHEME) - 1)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsURI methods:
|
// nsIURI methods:
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMozIconURI::GetSpec(nsACString &aSpec)
|
nsMozIconURI::GetSpec(nsACString &aSpec)
|
||||||
|
|
|
@ -81,6 +81,7 @@ NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||||
if (aIID.Equals(kThisSimpleURIImplementationCID))
|
if (aIID.Equals(kThisSimpleURIImplementationCID))
|
||||||
foundInterface = static_cast<nsIURI*>(this);
|
foundInterface = static_cast<nsIURI*>(this);
|
||||||
else
|
else
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -656,3 +657,21 @@ nsSimpleURI::SetMutable(bool value)
|
||||||
mMutable = value;
|
mMutable = value;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// nsSimpleURI::nsISizeOf
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsSimpleURI::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
|
||||||
|
mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
|
||||||
|
mRef.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsSimpleURI::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
|
||||||
|
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIClassInfo.h"
|
#include "nsIClassInfo.h"
|
||||||
#include "nsIMutable.h"
|
#include "nsIMutable.h"
|
||||||
|
#include "nsISizeOf.h"
|
||||||
|
|
||||||
#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
|
#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
|
||||||
{ /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \
|
{ /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \
|
||||||
|
@ -58,7 +59,8 @@ class nsSimpleURI : public nsIURI,
|
||||||
public nsISerializable,
|
public nsISerializable,
|
||||||
public nsIIPCSerializable,
|
public nsIIPCSerializable,
|
||||||
public nsIClassInfo,
|
public nsIClassInfo,
|
||||||
public nsIMutable
|
public nsIMutable,
|
||||||
|
public nsISizeOf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -73,6 +75,16 @@ public:
|
||||||
nsSimpleURI();
|
nsSimpleURI();
|
||||||
virtual ~nsSimpleURI();
|
virtual ~nsSimpleURI();
|
||||||
|
|
||||||
|
// nsISizeOf
|
||||||
|
// Among the sub-classes that inherit (directly or indirectly) from
|
||||||
|
// nsSimpleURI, measurement of the following members may be added later if
|
||||||
|
// DMD finds it is worthwhile:
|
||||||
|
// - nsJSURI: mBaseURI
|
||||||
|
// - nsSimpleNestedURI: mInnerURI
|
||||||
|
// - nsBlobURI: mPrincipal
|
||||||
|
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// enum used in a few places to specify how .ref attribute should be handled
|
// enum used in a few places to specify how .ref attribute should be handled
|
||||||
enum RefHandlingEnum {
|
enum RefHandlingEnum {
|
||||||
|
|
|
@ -978,6 +978,7 @@ NS_INTERFACE_MAP_BEGIN(nsStandardURL)
|
||||||
if (aIID.Equals(kThisImplCID))
|
if (aIID.Equals(kThisImplCID))
|
||||||
foundInterface = static_cast<nsIURI *>(this);
|
foundInterface = static_cast<nsIURI *>(this);
|
||||||
else
|
else
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -3068,3 +3069,26 @@ nsStandardURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
|
||||||
*aClassIDNoAlloc = kStandardURLCID;
|
*aClassIDNoAlloc = kStandardURLCID;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// nsStandardURL::nsISizeOf
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsStandardURL::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return mSpec.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
|
||||||
|
mOriginCharset.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
|
||||||
|
aMallocSizeOf(mHostA);
|
||||||
|
|
||||||
|
// Measurement of the following members may be added later if DMD finds it is
|
||||||
|
// worthwhile:
|
||||||
|
// - mParser
|
||||||
|
// - mFile
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
nsStandardURL::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
|
||||||
|
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsURLHelper.h"
|
#include "nsURLHelper.h"
|
||||||
#include "nsIClassInfo.h"
|
#include "nsIClassInfo.h"
|
||||||
|
#include "nsISizeOf.h"
|
||||||
#include "prclist.h"
|
#include "prclist.h"
|
||||||
|
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
|
@ -75,6 +76,7 @@ class nsStandardURL : public nsIFileURL
|
||||||
, public nsISerializable
|
, public nsISerializable
|
||||||
, public nsIIPCSerializable
|
, public nsIIPCSerializable
|
||||||
, public nsIClassInfo
|
, public nsIClassInfo
|
||||||
|
, public nsISizeOf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -87,6 +89,10 @@ public:
|
||||||
NS_DECL_NSICLASSINFO
|
NS_DECL_NSICLASSINFO
|
||||||
NS_DECL_NSIMUTABLE
|
NS_DECL_NSIMUTABLE
|
||||||
|
|
||||||
|
// nsISizeOf
|
||||||
|
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||||
|
|
||||||
nsStandardURL(bool aSupportsFileURL = false);
|
nsStandardURL(bool aSupportsFileURL = false);
|
||||||
virtual ~nsStandardURL();
|
virtual ~nsStandardURL();
|
||||||
|
|
||||||
|
@ -115,7 +121,6 @@ public: /* internal -- HPUX compiler can't handle this being private */
|
||||||
mLen += 1 + right.mLen;
|
mLen += 1 + right.mLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -74,6 +74,11 @@ public:
|
||||||
mDeathGrip = 0;
|
mDeathGrip = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
return 0; // the value shouldn't matter
|
||||||
|
}
|
||||||
|
|
||||||
~mock_Link() {
|
~mock_Link() {
|
||||||
// Run the next test if we are supposed to.
|
// Run the next test if we are supposed to.
|
||||||
if (mRunNextTest) {
|
if (mRunNextTest) {
|
||||||
|
@ -135,6 +140,13 @@ Link::GetURI() const
|
||||||
return nsnull; // suppress compiler warning
|
return nsnull; // suppress compiler warning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
Link::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
|
{
|
||||||
|
NS_NOTREACHED("Unexpected call to Link::SizeOfExcludingThis");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ EXPORTS = \
|
||||||
nsDebugImpl.h \
|
nsDebugImpl.h \
|
||||||
nsIAllocator.h \
|
nsIAllocator.h \
|
||||||
nsIID.h \
|
nsIID.h \
|
||||||
|
nsISizeOf.h \
|
||||||
nsISupportsObsolete.h \
|
nsISupportsObsolete.h \
|
||||||
nsStackWalk.h \
|
nsStackWalk.h \
|
||||||
nsTraceRefcntImpl.h \
|
nsTraceRefcntImpl.h \
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* mozilla.org
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Nicholas Nethercote <nnethercote@mozilla.com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#ifndef nsISizeOf_h___
|
||||||
|
#define nsISizeOf_h___
|
||||||
|
|
||||||
|
#include "nsISupports.h"
|
||||||
|
|
||||||
|
#define NS_ISIZEOF_IID \
|
||||||
|
{0x61d05579, 0xd7ec, 0x485c, \
|
||||||
|
{ 0xa4, 0x0c, 0x31, 0xc7, 0x9a, 0x5c, 0xf9, 0xf3 }}
|
||||||
|
|
||||||
|
class nsISizeOf : public nsISupports
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISIZEOF_IID)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Measures the size of the things pointed to by the object.
|
||||||
|
*/
|
||||||
|
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like SizeOfExcludingThis, but also includes the size of the object itself.
|
||||||
|
*/
|
||||||
|
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsISizeOf, NS_ISIZEOF_IID)
|
||||||
|
|
||||||
|
#endif /* nsISizeOf_h___ */
|
Загрузка…
Ссылка в новой задаче