mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 671299 (part 3) - Add style sheet memory reporters. r=dbaron.
This commit is contained in:
parent
b7dc73868e
commit
2806f8e46a
@ -1617,6 +1617,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual size_t SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||
|
||||
private:
|
||||
PRUint64 mWarnedAbout;
|
||||
|
||||
|
@ -9134,3 +9134,18 @@ nsDocument::GetMozVisibilityState(nsAString& aState)
|
||||
aState.AssignASCII(states[mVisibilityState]);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static size_t
|
||||
SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet,
|
||||
nsMallocSizeOfFun aMallocSizeOf,
|
||||
void* aData)
|
||||
{
|
||||
return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsDocument::SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return mStyleSheets.SizeOfExcludingThis(SizeOfStyleSheetsElementIncludingThis,
|
||||
aMallocSizeOf);
|
||||
}
|
||||
|
@ -991,6 +991,8 @@ public:
|
||||
// Posts an event to call UpdateVisibilityState
|
||||
virtual void PostVisibilityUpdateEvent();
|
||||
|
||||
virtual size_t SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
protected:
|
||||
friend class nsNodeUtils;
|
||||
|
||||
|
@ -88,14 +88,22 @@ AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
CollectWindowMemoryUsage(nsGlobalWindow *aWindow,
|
||||
nsIMemoryMultiReporterCallback *aCb,
|
||||
nsISupports *aClosure)
|
||||
struct WindowTotals
|
||||
{
|
||||
NS_NAMED_LITERAL_CSTRING(kWindowDesc,
|
||||
"Memory used by a window and the DOM within it.");
|
||||
WindowTotals() : mDom(0), mStyleSheets(0) {}
|
||||
size_t mDom;
|
||||
size_t mStyleSheets;
|
||||
};
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WindowStyleSheetsMallocSizeOf,
|
||||
"window/style-sheets")
|
||||
|
||||
static void
|
||||
CollectWindowReports(nsGlobalWindow *aWindow,
|
||||
WindowTotals *aWindowTotals,
|
||||
nsIMemoryMultiReporterCallback *aCb,
|
||||
nsISupports *aClosure)
|
||||
{
|
||||
// DOM window objects fall into one of three categories:
|
||||
// - "active" windows are currently either displayed in an active
|
||||
// tab, or a child of such a window.
|
||||
@ -119,7 +127,7 @@ CollectWindowMemoryUsage(nsGlobalWindow *aWindow,
|
||||
// The path we give to the reporter callback for inner windows are
|
||||
// as follows:
|
||||
//
|
||||
// explicit/dom/window-objects/<category>/top=<top-outer-id> (inner=<top-inner-id>)/inner-window(id=<id>, uri=<uri>)
|
||||
// explicit/dom+style/window-objects/<category>/top=<top-outer-id> (inner=<top-inner-id>)/inner-window(id=<id>, uri=<uri>)
|
||||
//
|
||||
// Where:
|
||||
// - <category> is active, cached, or other, as described above.
|
||||
@ -138,62 +146,82 @@ CollectWindowMemoryUsage(nsGlobalWindow *aWindow,
|
||||
//
|
||||
// For outer windows we simply use:
|
||||
//
|
||||
// explicit/dom/window-objects/<category>/outer-windows
|
||||
// explicit/dom+style/window-objects/<category>/outer-windows
|
||||
//
|
||||
// Which gives us simple counts of how many outer windows (and their
|
||||
// combined sizes) per category.
|
||||
|
||||
nsCAutoString str("explicit/dom/window-objects/");
|
||||
nsCAutoString windowPath("explicit/dom+style/window-objects/");
|
||||
|
||||
nsIDocShell *docShell = aWindow->GetDocShell();
|
||||
|
||||
nsGlobalWindow *top = aWindow->GetTop();
|
||||
PRInt64 windowSize = aWindow->SizeOf();
|
||||
PRInt64 windowDOMSize = aWindow->SizeOf();
|
||||
PRInt64 styleSheetsSize = aWindow->SizeOfStyleSheets(WindowStyleSheetsMallocSizeOf);
|
||||
|
||||
if (docShell && aWindow->IsFrozen()) {
|
||||
str += NS_LITERAL_CSTRING("cached/");
|
||||
windowPath += NS_LITERAL_CSTRING("cached/");
|
||||
} else if (docShell) {
|
||||
str += NS_LITERAL_CSTRING("active/");
|
||||
windowPath += NS_LITERAL_CSTRING("active/");
|
||||
} else {
|
||||
str += NS_LITERAL_CSTRING("other/");
|
||||
windowPath += NS_LITERAL_CSTRING("other/");
|
||||
}
|
||||
|
||||
if (aWindow->IsInnerWindow()) {
|
||||
str += NS_LITERAL_CSTRING("top=");
|
||||
windowPath += NS_LITERAL_CSTRING("top=");
|
||||
|
||||
if (top) {
|
||||
str.AppendInt(top->WindowID());
|
||||
windowPath.AppendInt(top->WindowID());
|
||||
|
||||
nsGlobalWindow *topInner = top->GetCurrentInnerWindowInternal();
|
||||
if (topInner) {
|
||||
str += NS_LITERAL_CSTRING(" (inner=");
|
||||
str.AppendInt(topInner->WindowID());
|
||||
str += NS_LITERAL_CSTRING(")");
|
||||
windowPath += NS_LITERAL_CSTRING(" (inner=");
|
||||
windowPath.AppendInt(topInner->WindowID());
|
||||
windowPath += NS_LITERAL_CSTRING(")");
|
||||
}
|
||||
} else {
|
||||
str += NS_LITERAL_CSTRING("none");
|
||||
windowPath += NS_LITERAL_CSTRING("none");
|
||||
}
|
||||
|
||||
str += NS_LITERAL_CSTRING("/inner-window(id=");
|
||||
str.AppendInt(aWindow->WindowID());
|
||||
str += NS_LITERAL_CSTRING(", uri=");
|
||||
windowPath += NS_LITERAL_CSTRING("/inner-window(id=");
|
||||
windowPath.AppendInt(aWindow->WindowID());
|
||||
windowPath += NS_LITERAL_CSTRING(", uri=");
|
||||
|
||||
if (!AppendWindowURI(aWindow, str)) {
|
||||
str += NS_LITERAL_CSTRING("[system]");
|
||||
if (!AppendWindowURI(aWindow, windowPath)) {
|
||||
windowPath += NS_LITERAL_CSTRING("[system]");
|
||||
}
|
||||
|
||||
str += NS_LITERAL_CSTRING(")");
|
||||
windowPath += NS_LITERAL_CSTRING(")");
|
||||
} else {
|
||||
// Combine all outer windows per section (active/cached/other) as
|
||||
// they basically never contain anything of interest, and are
|
||||
// always pretty much the same size.
|
||||
|
||||
str += NS_LITERAL_CSTRING("outer-windows");
|
||||
windowPath += NS_LITERAL_CSTRING("outer-windows");
|
||||
}
|
||||
|
||||
aCb->Callback(EmptyCString(), str, nsIMemoryReporter::KIND_HEAP,
|
||||
nsIMemoryReporter::UNITS_BYTES, windowSize, kWindowDesc,
|
||||
aClosure);
|
||||
if (windowDOMSize > 0) {
|
||||
nsCAutoString domPath(windowPath);
|
||||
domPath += "/dom";
|
||||
NS_NAMED_LITERAL_CSTRING(kWindowDesc,
|
||||
"Memory used by a window and the DOM within it.");
|
||||
aCb->Callback(EmptyCString(), domPath, nsIMemoryReporter::KIND_HEAP,
|
||||
nsIMemoryReporter::UNITS_BYTES, windowDOMSize, kWindowDesc,
|
||||
aClosure);
|
||||
aWindowTotals->mDom += windowDOMSize;
|
||||
}
|
||||
|
||||
if (styleSheetsSize > 0) {
|
||||
nsCAutoString styleSheetsPath(windowPath);
|
||||
styleSheetsPath += "/style-sheets";
|
||||
NS_NAMED_LITERAL_CSTRING(kStyleSheetsDesc,
|
||||
"Memory used by style sheets within a window.");
|
||||
aCb->Callback(EmptyCString(), styleSheetsPath,
|
||||
nsIMemoryReporter::KIND_HEAP,
|
||||
nsIMemoryReporter::UNITS_BYTES, styleSheetsSize,
|
||||
kStyleSheetsDesc, aClosure);
|
||||
aWindowTotals->mStyleSheets += styleSheetsSize;
|
||||
}
|
||||
}
|
||||
|
||||
typedef nsTArray< nsRefPtr<nsGlobalWindow> > WindowArray;
|
||||
@ -223,10 +251,27 @@ nsDOMMemoryMultiReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb,
|
||||
// Collect window memory usage.
|
||||
nsRefPtr<nsGlobalWindow> *w = windows.Elements();
|
||||
nsRefPtr<nsGlobalWindow> *end = w + windows.Length();
|
||||
WindowTotals windowTotals;
|
||||
for (; w != end; ++w) {
|
||||
CollectWindowMemoryUsage(*w, aCb, aClosure);
|
||||
CollectWindowReports(*w, &windowTotals, aCb, aClosure);
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(kDomTotalWindowsDesc,
|
||||
"Memory used for the DOM within windows. This is the sum of all windows' "
|
||||
"'dom' numbers.");
|
||||
aCb->Callback(EmptyCString(), NS_LITERAL_CSTRING("dom-total-window"),
|
||||
nsIMemoryReporter::KIND_OTHER,
|
||||
nsIMemoryReporter::UNITS_BYTES, windowTotals.mDom,
|
||||
kDomTotalWindowsDesc, aClosure);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(kLayoutTotalWindowStyleSheetsDesc,
|
||||
"Memory used for style sheets within windows. This is the sum of all windows' "
|
||||
"'style-sheets' numbers.");
|
||||
aCb->Callback(EmptyCString(), NS_LITERAL_CSTRING("style-sheets-total-window"),
|
||||
nsIMemoryReporter::KIND_OTHER,
|
||||
nsIMemoryReporter::UNITS_BYTES, windowTotals.mStyleSheets,
|
||||
kLayoutTotalWindowStyleSheetsDesc, aClosure);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -10296,6 +10296,16 @@ nsGlobalWindow::SizeOf() const
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsGlobalWindow::SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
if (IsInnerWindow() && mDoc) {
|
||||
n += mDoc->SizeOfStyleSheets(aMallocSizeOf);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// nsGlobalChromeWindow implementation
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)
|
||||
|
@ -576,6 +576,7 @@ public:
|
||||
}
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
size_t SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
void UnmarkGrayTimers();
|
||||
private:
|
||||
|
@ -155,6 +155,8 @@ SwapToISupportsArray(SmartPtr<T>& aSrc,
|
||||
dest->swap(rawSupports);
|
||||
}
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsWorkerMallocSizeOf, "js-worker")
|
||||
|
||||
class WorkerMemoryReporter : public nsIMemoryMultiReporter
|
||||
{
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
@ -232,7 +234,7 @@ public:
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
JS::RuntimeStats rtStats(xpc::JsMallocSizeOf, xpc::GetCompartmentName,
|
||||
JS::RuntimeStats rtStats(JsWorkerMallocSizeOf, xpc::GetCompartmentName,
|
||||
xpc::DestroyCompartmentName);
|
||||
nsresult rv = CollectForRuntime(/* isQuick = */false, &rtStats);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -1523,7 +1525,7 @@ public:
|
||||
JSAutoSuspendRequest asr(aCx);
|
||||
|
||||
*mSucceeded = mIsQuick
|
||||
? JS::GetExplicitNonHeapForRuntime(JS_GetRuntime(aCx), static_cast<int64_t*>(mData), xpc::JsMallocSizeOf)
|
||||
? JS::GetExplicitNonHeapForRuntime(JS_GetRuntime(aCx), static_cast<int64_t*>(mData), JsWorkerMallocSizeOf)
|
||||
: JS::CollectRuntimeStats(JS_GetRuntime(aCx), static_cast<JS::RuntimeStats*>(mData));
|
||||
|
||||
{
|
||||
|
@ -1275,8 +1275,6 @@ DestroyCompartmentName(void *string)
|
||||
delete static_cast<nsCString*>(string);
|
||||
}
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsMallocSizeOf, "js")
|
||||
|
||||
} // namespace xpc
|
||||
|
||||
namespace {
|
||||
@ -1725,6 +1723,8 @@ ReportJSRuntimeStats(const JS::RuntimeStats &rtStats, const nsACString &pathPref
|
||||
} // namespace xpconnect
|
||||
} // namespace mozilla
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsMallocSizeOf, "js")
|
||||
|
||||
class XPConnectJSCompartmentsMultiReporter : public nsIMemoryMultiReporter
|
||||
{
|
||||
public:
|
||||
@ -1740,7 +1740,7 @@ public:
|
||||
// the callback. Separating these steps is important because the
|
||||
// callback may be a JS function, and executing JS while getting these
|
||||
// stats seems like a bad idea.
|
||||
JS::RuntimeStats rtStats(xpc::JsMallocSizeOf, xpc::GetCompartmentName,
|
||||
JS::RuntimeStats rtStats(JsMallocSizeOf, xpc::GetCompartmentName,
|
||||
xpc::DestroyCompartmentName);
|
||||
if (!JS::CollectRuntimeStats(xpcrt->GetJSRuntime(), &rtStats))
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1748,8 +1748,8 @@ public:
|
||||
size_t xpconnect;
|
||||
{
|
||||
xpconnect =
|
||||
xpcrt->SizeOfIncludingThis(xpc::JsMallocSizeOf) +
|
||||
XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(xpc::JsMallocSizeOf);
|
||||
xpcrt->SizeOfIncludingThis(JsMallocSizeOf) +
|
||||
XPCWrappedNativeScope::SizeOfAllScopesIncludingThis(JsMallocSizeOf);
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(pathPrefix, "explicit/js/");
|
||||
@ -1855,7 +1855,7 @@ public:
|
||||
{
|
||||
JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime();
|
||||
|
||||
if (!JS::GetExplicitNonHeapForRuntime(rt, reinterpret_cast<int64_t*>(n), xpc::JsMallocSizeOf))
|
||||
if (!JS::GetExplicitNonHeapForRuntime(rt, reinterpret_cast<int64_t*>(n), JsMallocSizeOf))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -219,7 +219,6 @@ bool StringToJsval(JSContext *cx, nsString &str, JS::Value *rval);
|
||||
|
||||
void *GetCompartmentName(JSContext *cx, JSCompartment *c);
|
||||
void DestroyCompartmentName(void *string);
|
||||
size_t JsMallocSizeOf(const void *ptr);
|
||||
|
||||
} // namespace xpc
|
||||
|
||||
|
@ -965,9 +965,10 @@ public:
|
||||
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
|
||||
// XXX: lots of things hang off nsPresContext and should be included in
|
||||
// this measurement. Bug 671299 may add them.
|
||||
return 0;
|
||||
|
||||
// Measurement of other members may be added later if DMD finds it is
|
||||
// worthwhile.
|
||||
}
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
|
||||
@ -1318,9 +1319,17 @@ public:
|
||||
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE {
|
||||
// XXX: several things hang off an nsRootPresContext and should be included
|
||||
// in this measurement. Bug 671299 may do this.
|
||||
return nsPresContext::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mNotifyDidPaintTimer
|
||||
// - mRegisteredPlugins
|
||||
// - mWillPaintObservers
|
||||
// - mWillPaintFallbackEvent
|
||||
//
|
||||
// The following member are not measured:
|
||||
// - mUpdatePluginGeometryForFrame, because it is non-owning
|
||||
}
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE {
|
||||
|
@ -129,7 +129,13 @@ CommonAnimationManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
||||
/* virtual */ size_t
|
||||
CommonAnimationManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
// XXX: could measure mProperytValuePairs here. Bug 671299 may do this.
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mElementData
|
||||
//
|
||||
// The following members are not measured
|
||||
// - mPresContext, because it's non-owning
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -994,5 +994,15 @@ Declaration::EnsureMutable()
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
Declaration::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mOrder.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mData ? mData ->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
n += mImportantData ? mImportantData->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
} // namespace mozilla::css
|
||||
} // namespace mozilla
|
||||
|
@ -257,6 +257,8 @@ public:
|
||||
return nsCSSProperty(mOrder.ElementAt(aValue));
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
nsAutoTArray<PRUint8, 8> mOrder;
|
||||
|
||||
|
@ -96,6 +96,11 @@ public:
|
||||
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
||||
nsMediaQueryResultCacheKey& aKey) = 0;
|
||||
|
||||
NS_MUST_OVERRIDE size_t // non-virtual -- it is only called by subclasses
|
||||
SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
virtual size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||
|
||||
protected:
|
||||
// to help implement nsIDOMCSSRule
|
||||
nsresult AppendRulesToCssText(nsAString& aCssText);
|
||||
|
@ -81,6 +81,8 @@ public:
|
||||
|
||||
void SetSheet(nsCSSStyleSheet*);
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
// nsIDOMCSSRule interface
|
||||
NS_DECL_NSIDOMCSSRULE
|
||||
|
||||
|
@ -84,6 +84,9 @@ public:
|
||||
|
||||
void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; }
|
||||
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
// nsIDOMCSSRule interface
|
||||
NS_DECL_NSIDOMCSSRULE
|
||||
|
||||
|
@ -129,6 +129,16 @@ public:
|
||||
nsresult GetParentRule(nsIDOMCSSRule** aParentRule);
|
||||
nsresult GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet);
|
||||
|
||||
// This is pure virtual because all of Rule's data members are non-owning and
|
||||
// thus measured elsewhere.
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||
|
||||
// This is used to measure nsCOMArray<Rule>s.
|
||||
static size_t SizeOfCOMArrayElementIncludingThis(css::Rule* aElement,
|
||||
nsMallocSizeOfFun aMallocSizeOf,
|
||||
void* aData);
|
||||
|
||||
protected:
|
||||
nsCSSStyleSheet* mSheet;
|
||||
GroupRule* mParentRule;
|
||||
|
@ -125,6 +125,22 @@ nsAtomList::Clone(bool aDeep) const
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsAtomList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsAtomList* a = this;
|
||||
while (a) {
|
||||
n += aMallocSizeOf(a);
|
||||
|
||||
// The following members aren't measured:
|
||||
// - a->mAtom, because it may be shared
|
||||
|
||||
a = a->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
nsAtomList::~nsAtomList(void)
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsAtomList);
|
||||
@ -204,6 +220,32 @@ nsPseudoClassList::Clone(bool aDeep) const
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsPseudoClassList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsPseudoClassList* p = this;
|
||||
while (p) {
|
||||
n += aMallocSizeOf(p);
|
||||
if (!p->u.mMemory) {
|
||||
// do nothing
|
||||
|
||||
} else if (nsCSSPseudoClasses::HasStringArg(p->mType)) {
|
||||
n += aMallocSizeOf(p->u.mString);
|
||||
|
||||
} else if (nsCSSPseudoClasses::HasNthPairArg(p->mType)) {
|
||||
n += aMallocSizeOf(p->u.mNumbers);
|
||||
|
||||
} else {
|
||||
NS_ASSERTION(nsCSSPseudoClasses::HasSelectorListArg(p->mType),
|
||||
"unexpected pseudo-class");
|
||||
n += p->u.mSelectors->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
p = p->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
nsPseudoClassList::~nsPseudoClassList(void)
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsPseudoClassList);
|
||||
@ -810,6 +852,34 @@ nsCSSSelector::CanBeNamespaced(bool aIsNegated) const
|
||||
(!mIDList && !mClassList && !mPseudoClassList && !mAttrList);
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSSelector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsCSSSelector* s = this;
|
||||
while (s) {
|
||||
n += aMallocSizeOf(s);
|
||||
|
||||
#define MEASURE(x) n += x ? x->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
|
||||
MEASURE(s->mIDList);
|
||||
MEASURE(s->mClassList);
|
||||
MEASURE(s->mPseudoClassList);
|
||||
MEASURE(s->mNegations);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - s->mAttrList
|
||||
//
|
||||
// The following members aren't measured:
|
||||
// - s->mLowercaseTag, because it's an atom and therefore shared
|
||||
// - s->mCasedTag, because it's an atom and therefore shared
|
||||
|
||||
s = s->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// -- nsCSSSelectorList -------------------------------
|
||||
|
||||
nsCSSSelectorList::nsCSSSelectorList(void)
|
||||
@ -872,6 +942,19 @@ nsCSSSelectorList::Clone(bool aDeep) const
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSSelectorList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsCSSSelectorList* s = this;
|
||||
while (s) {
|
||||
n += aMallocSizeOf(s);
|
||||
n += s->mSelectors ? s->mSelectors->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
s = s->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// -- ImportantRule ----------------------------------
|
||||
|
||||
namespace mozilla {
|
||||
@ -1422,5 +1505,21 @@ StyleRule::SetSelectorText(const nsAString& aSelectorText)
|
||||
// XXX and dirty sheet
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
StyleRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mSelector ? mSelector->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
n += mDeclaration ? mDeclaration->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mImportantRule;
|
||||
// - mDOMRule;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
@ -70,6 +70,8 @@ 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;
|
||||
|
||||
nsCOMPtr<nsIAtom> mAtom;
|
||||
nsAtomList* mNext;
|
||||
private:
|
||||
@ -91,6 +93,8 @@ 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;
|
||||
|
||||
union {
|
||||
// For a given value of mType, we have either:
|
||||
// a. no value, which means mMemory is always null
|
||||
@ -217,6 +221,8 @@ public:
|
||||
mPseudoType = static_cast<PRInt16>(aType);
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
// For case-sensitive documents, mLowercaseTag is the same as mCasedTag,
|
||||
// but in case-insensitive documents (HTML) mLowercaseTag is lowercase.
|
||||
// Also, for pseudo-elements mCasedTag will be null but mLowercaseTag
|
||||
@ -271,6 +277,8 @@ struct nsCSSSelectorList {
|
||||
*/
|
||||
nsCSSSelectorList* Clone() const { return Clone(true); }
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
nsCSSSelector* mSelectors;
|
||||
PRInt32 mWeight;
|
||||
nsCSSSelectorList* mNext;
|
||||
@ -380,6 +388,8 @@ public:
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
~StyleRule();
|
||||
|
||||
|
@ -435,9 +435,12 @@ nsAnimationManager::RulesMatching(XULTreeRuleProcessorData* aData)
|
||||
/* virtual */ size_t
|
||||
nsAnimationManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
// XXX: various other members in nsAnimationManager could be measured here.
|
||||
// Bug 671299 may do this.
|
||||
return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mKeyframesRules
|
||||
// - mPendingEvents
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
|
@ -307,6 +307,20 @@ nsCSSCompressedDataBlock::CreateEmptyBlock()
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSCompressedDataBlock::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
|
||||
const char* cursor = Block();
|
||||
const char* cursor_end = BlockEnd();
|
||||
while (cursor < cursor_end) {
|
||||
n += ValueAtCursor(cursor)->SizeOfExcludingThis(aMallocSizeOf);
|
||||
cursor += CDBValueStorage_advance;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
nsCSSExpandedDataBlock::nsCSSExpandedDataBlock()
|
||||
|
@ -121,6 +121,8 @@ public:
|
||||
*/
|
||||
static nsCSSCompressedDataBlock* CreateEmptyBlock();
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
void* operator new(size_t aBaseSize, size_t aDataSize) {
|
||||
NS_ABORT_IF_FALSE(aBaseSize == sizeof(nsCSSCompressedDataBlock),
|
||||
|
@ -117,6 +117,13 @@ Rule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
size_t
|
||||
Rule::SizeOfCOMArrayElementIncludingThis(css::Rule* aElement,
|
||||
nsMallocSizeOfFun aMallocSizeOf,
|
||||
void* aData)
|
||||
{
|
||||
return aElement->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
// -------------------------------
|
||||
// Style Rule List for group rules
|
||||
@ -322,7 +329,15 @@ CharsetRule::GetParentRule(nsIDOMCSSRule** aParentRule)
|
||||
return Rule::GetParentRule(aParentRule);
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
CharsetRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mEncoding
|
||||
}
|
||||
|
||||
// -------------------------------------------
|
||||
// ImportRule
|
||||
@ -490,6 +505,20 @@ ImportRule::GetStyleSheet(nsIDOMCSSStyleSheet * *aStyleSheet)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
ImportRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mURLSpec
|
||||
//
|
||||
// The following members are not measured:
|
||||
// - mMedia, because it is measured via nsCSSStyleSheet::mMedia
|
||||
// - mChildSheet, because it is measured via nsCSSStyleSheetInner::mSheets
|
||||
}
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
@ -695,6 +724,17 @@ GroupRule::DeleteRule(PRUint32 aIndex)
|
||||
return mSheet->DeleteRuleFromGroup(this, aIndex);
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
GroupRule::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return mRules.SizeOfExcludingThis(Rule::SizeOfCOMArrayElementIncludingThis,
|
||||
aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mRuleCollection
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------
|
||||
// nsICSSMediaRule
|
||||
@ -866,6 +906,19 @@ MediaRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
return true;
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
MediaRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += GroupRule::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mMedia
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
@ -1075,6 +1128,19 @@ DocumentRule::URL::~URL()
|
||||
NS_CSS_DELETE_LIST_MEMBER(DocumentRule::URL, this, next);
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
DocumentRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += GroupRule::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mURLs
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
@ -1199,6 +1265,18 @@ NameSpaceRule::GetParentRule(nsIDOMCSSRule** aParentRule)
|
||||
return Rule::GetParentRule(aParentRule);
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
NameSpaceRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mPrefix
|
||||
// - mURLSpec
|
||||
}
|
||||
|
||||
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
@ -1660,6 +1738,17 @@ nsCSSFontFaceRule::GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue)
|
||||
aValue = mDecl.*nsCSSFontFaceStyleDecl::Fields[aDescID];
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsCSSFontFaceRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mDecl
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------
|
||||
// nsCSSKeyframeStyleDeclaration
|
||||
//
|
||||
@ -1882,6 +1971,19 @@ nsCSSKeyframeRule::ChangeDeclaration(css::Declaration* aDeclaration)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsCSSKeyframeRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mKeys
|
||||
// - mDeclaration
|
||||
// - mDOMDeclaration
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------
|
||||
// nsCSSKeyframesRule
|
||||
//
|
||||
@ -2079,3 +2181,17 @@ nsCSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext,
|
||||
return false;
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsCSSKeyframesRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += GroupRule::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mName
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,6 +111,9 @@ public:
|
||||
// @media rule methods
|
||||
nsresult SetMedia(nsMediaList* aMedia);
|
||||
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
protected:
|
||||
nsRefPtr<nsMediaList> mMedia;
|
||||
};
|
||||
@ -174,6 +177,9 @@ public:
|
||||
|
||||
void SetURLs(URL *aURLs) { mURLs = aURLs; }
|
||||
|
||||
virtual NS_MUST_OVERRIDE size_t
|
||||
SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
protected:
|
||||
nsAutoPtr<URL> mURLs; // linked list of |struct URL| above.
|
||||
};
|
||||
@ -241,6 +247,8 @@ public:
|
||||
void SetDesc(nsCSSFontDesc aDescID, nsCSSValue const & aValue);
|
||||
void GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue);
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
protected:
|
||||
friend class nsCSSFontFaceStyleDecl;
|
||||
nsCSSFontFaceStyleDecl mDecl;
|
||||
@ -301,6 +309,8 @@ public:
|
||||
NS_IMETHOD GetEncoding(nsAString& aEncoding);
|
||||
NS_IMETHOD SetEncoding(const nsAString& aEncoding);
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
nsString mEncoding;
|
||||
};
|
||||
@ -378,6 +388,8 @@ public:
|
||||
|
||||
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
nsAutoTArray<float, 1> mKeys;
|
||||
nsAutoPtr<mozilla::css::Declaration> mDeclaration;
|
||||
@ -424,6 +436,8 @@ public:
|
||||
|
||||
const nsString& GetName() { return mName; }
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
PRUint32 FindRuleIndexForKey(const nsAString& aKey);
|
||||
|
||||
|
@ -874,6 +874,30 @@ nsCSSStyleSheet::RebuildChildList(css::Rule* aRule, void* aBuilder)
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSStyleSheet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsCSSStyleSheet* s = this;
|
||||
while (s) {
|
||||
n += aMallocSizeOf(s);
|
||||
n += s->mInner->SizeOfIncludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - s->mTitle
|
||||
// - s->mMedia
|
||||
// - s->mRuleCollection
|
||||
// - s->mRuleProcessors
|
||||
//
|
||||
// The following members are not measured:
|
||||
// - s->mOwnerRule, because it's non-owning
|
||||
|
||||
s = s->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
nsCSSStyleSheetInner::nsCSSStyleSheetInner(nsCSSStyleSheetInner& aCopy,
|
||||
nsCSSStyleSheet* aPrimarySheet)
|
||||
: mSheets(),
|
||||
@ -983,6 +1007,28 @@ nsCSSStyleSheetInner::CreateNamespaceMap()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSStyleSheetInner::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mOrderedRules.SizeOfExcludingThis(css::Rule::SizeOfCOMArrayElementIncludingThis,
|
||||
aMallocSizeOf);
|
||||
n += mFirstChild ? mFirstChild->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mSheetURI
|
||||
// - mOriginalSheetURI
|
||||
// - mBaseURI
|
||||
// - mPrincipal
|
||||
// - mNameSpaceMap
|
||||
//
|
||||
// The following members are not measured:
|
||||
// - mSheets, because it's non-owning
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// -------------------------------
|
||||
// CSS Style Sheet
|
||||
//
|
||||
|
@ -99,6 +99,8 @@ private:
|
||||
// Create a new namespace map
|
||||
nsresult CreateNamespaceMap();
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
nsAutoTArray<nsCSSStyleSheet*, 8> mSheets;
|
||||
nsCOMPtr<nsIURI> mSheetURI; // for error reports, etc.
|
||||
nsCOMPtr<nsIURI> mOriginalSheetURI; // for GetHref. Can be null.
|
||||
@ -266,6 +268,8 @@ 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;
|
||||
|
||||
private:
|
||||
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
|
||||
nsCSSStyleSheet* aParentToUse,
|
||||
|
@ -1114,6 +1114,141 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValue::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
switch (GetUnit()) {
|
||||
// No value: nothing extra to measure.
|
||||
case eCSSUnit_Null:
|
||||
case eCSSUnit_Auto:
|
||||
case eCSSUnit_Inherit:
|
||||
case eCSSUnit_Initial:
|
||||
case eCSSUnit_None:
|
||||
case eCSSUnit_Normal:
|
||||
case eCSSUnit_System_Font:
|
||||
case eCSSUnit_All:
|
||||
case eCSSUnit_Dummy:
|
||||
case eCSSUnit_DummyInherit:
|
||||
break;
|
||||
|
||||
// String
|
||||
case eCSSUnit_String:
|
||||
case eCSSUnit_Ident:
|
||||
case eCSSUnit_Families:
|
||||
case eCSSUnit_Attr:
|
||||
case eCSSUnit_Local_Font:
|
||||
case eCSSUnit_Font_Format:
|
||||
case eCSSUnit_Element:
|
||||
n += mValue.mString->SizeOfIncludingThisIfUnshared(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// Array
|
||||
case eCSSUnit_Array:
|
||||
case eCSSUnit_Counter:
|
||||
case eCSSUnit_Counters:
|
||||
case eCSSUnit_Cubic_Bezier:
|
||||
case eCSSUnit_Steps:
|
||||
case eCSSUnit_Function:
|
||||
case eCSSUnit_Calc:
|
||||
case eCSSUnit_Calc_Plus:
|
||||
case eCSSUnit_Calc_Minus:
|
||||
case eCSSUnit_Calc_Times_L:
|
||||
case eCSSUnit_Calc_Times_R:
|
||||
case eCSSUnit_Calc_Divided:
|
||||
break;
|
||||
|
||||
// URL
|
||||
case eCSSUnit_URL:
|
||||
n += mValue.mURL->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// Image
|
||||
case eCSSUnit_Image:
|
||||
// Not yet measured. Measurement may be added later if DMD finds it
|
||||
// worthwhile.
|
||||
break;
|
||||
|
||||
// Gradient
|
||||
case eCSSUnit_Gradient:
|
||||
n += mValue.mGradient->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// Pair
|
||||
case eCSSUnit_Pair:
|
||||
n += mValue.mPair->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// Triplet
|
||||
case eCSSUnit_Triplet:
|
||||
n += mValue.mTriplet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// Rect
|
||||
case eCSSUnit_Rect:
|
||||
n += mValue.mRect->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// List
|
||||
case eCSSUnit_List:
|
||||
n += mValue.mList->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// ListDep: not measured because it's non-owning.
|
||||
case eCSSUnit_ListDep:
|
||||
break;
|
||||
|
||||
// PairList
|
||||
case eCSSUnit_PairList:
|
||||
n += mValue.mPairList->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// PairListDep: not measured because it's non-owning.
|
||||
case eCSSUnit_PairListDep:
|
||||
break;
|
||||
|
||||
// Int: nothing extra to measure.
|
||||
case eCSSUnit_Integer:
|
||||
case eCSSUnit_Enumerated:
|
||||
case eCSSUnit_EnumColor:
|
||||
break;
|
||||
|
||||
// Color: nothing extra to measure.
|
||||
case eCSSUnit_Color:
|
||||
break;
|
||||
|
||||
// Float: nothing extra to measure.
|
||||
case eCSSUnit_Percent:
|
||||
case eCSSUnit_Number:
|
||||
case eCSSUnit_PhysicalMillimeter:
|
||||
case eCSSUnit_EM:
|
||||
case eCSSUnit_XHeight:
|
||||
case eCSSUnit_Char:
|
||||
case eCSSUnit_RootEM:
|
||||
case eCSSUnit_Point:
|
||||
case eCSSUnit_Inch:
|
||||
case eCSSUnit_Millimeter:
|
||||
case eCSSUnit_Centimeter:
|
||||
case eCSSUnit_Pica:
|
||||
case eCSSUnit_Pixel:
|
||||
case eCSSUnit_Degree:
|
||||
case eCSSUnit_Grad:
|
||||
case eCSSUnit_Radian:
|
||||
case eCSSUnit_Hertz:
|
||||
case eCSSUnit_Kilohertz:
|
||||
case eCSSUnit_Seconds:
|
||||
case eCSSUnit_Milliseconds:
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ABORT_IF_FALSE(false, "bad nsCSSUnit");
|
||||
break;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// --- nsCSSValueList -----------------
|
||||
|
||||
nsCSSValueList::~nsCSSValueList()
|
||||
@ -1175,6 +1310,28 @@ nsCSSValueList::operator==(const nsCSSValueList& aOther) const
|
||||
return !p1 && !p2; // true if same length, false otherwise
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValueList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsCSSValueList* v = this;
|
||||
while (v) {
|
||||
n += aMallocSizeOf(v);
|
||||
n += v->mValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
v = v->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValueList_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mNext ? mNext->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
// --- nsCSSRect -----------------
|
||||
|
||||
nsCSSRect::nsCSSRect(void)
|
||||
@ -1239,6 +1396,17 @@ void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue)
|
||||
mLeft = aValue;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSRect_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mTop .SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mRight .SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mBottom.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mLeft .SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
PR_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
||||
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3);
|
||||
|
||||
@ -1262,7 +1430,25 @@ nsCSSValuePair::AppendToString(nsCSSProperty aProperty,
|
||||
}
|
||||
}
|
||||
|
||||
// --- nsCSSValueTriple -----------------
|
||||
size_t
|
||||
nsCSSValuePair::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValuePair_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
// --- nsCSSValueTriplet -----------------
|
||||
|
||||
void
|
||||
nsCSSValueTriplet::AppendToString(nsCSSProperty aProperty,
|
||||
@ -1279,6 +1465,16 @@ nsCSSValueTriplet::AppendToString(nsCSSProperty aProperty,
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValueTriplet_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mZValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
// --- nsCSSValuePairList -----------------
|
||||
|
||||
nsCSSValuePairList::~nsCSSValuePairList()
|
||||
@ -1342,6 +1538,40 @@ nsCSSValuePairList::operator==(const nsCSSValuePairList& aOther) const
|
||||
return !p1 && !p2; // true if same length, false otherwise
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValuePairList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
const nsCSSValuePairList* v = this;
|
||||
while (v) {
|
||||
n += aMallocSizeOf(v);
|
||||
n += v->mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += v->mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
v = v->mNext;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValuePairList_heap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mNext ? mNext->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValue::Array::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
for (size_t i = 0; i < mCount; i++) {
|
||||
n += mArray[i].SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
nsCSSValue::URL::URL(nsIURI* aURI, nsStringBuffer* aString,
|
||||
nsIURI* aReferrer, nsIPrincipal* aOriginPrincipal)
|
||||
: mURI(aURI),
|
||||
@ -1418,6 +1648,24 @@ nsCSSValue::URL::GetURI() const
|
||||
return mURI;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValue::URL::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
|
||||
// This string is unshared.
|
||||
n += mString->SizeOfIncludingThisMustBeUnshared(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mURI
|
||||
// - mReferrer
|
||||
// - mOriginPrincipal
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
nsCSSValue::Image::Image(nsIURI* aURI, nsStringBuffer* aString,
|
||||
nsIURI* aReferrer, nsIPrincipal* aOriginPrincipal,
|
||||
nsIDocument* aDocument)
|
||||
@ -1458,6 +1706,15 @@ nsCSSValueGradientStop::~nsCSSValueGradientStop()
|
||||
MOZ_COUNT_DTOR(nsCSSValueGradientStop);
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValueGradientStop::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
n += mLocation.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mColor .SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
nsCSSValueGradient::nsCSSValueGradient(bool aIsRadial,
|
||||
bool aIsRepeating)
|
||||
: mIsRadial(aIsRadial),
|
||||
@ -1470,6 +1727,21 @@ nsCSSValueGradient::nsCSSValueGradient(bool aIsRadial,
|
||||
{
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSValueGradient::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mBgPos .SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mAngle .SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mRadialShape.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mRadialSize .SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mStops .SizeOfExcludingThis(aMallocSizeOf);
|
||||
for (PRUint32 i = 0; i < mStops.Length(); i++) {
|
||||
n += mStops[i].SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// --- nsCSSCornerSizes -----------------
|
||||
|
||||
nsCSSCornerSizes::nsCSSCornerSizes(void)
|
||||
|
@ -454,6 +454,8 @@ public:
|
||||
static already_AddRefed<nsStringBuffer>
|
||||
BufferFromString(const nsString& aValue);
|
||||
|
||||
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
struct URL {
|
||||
// Methods are not inline because using an nsIPrincipal means requiring
|
||||
// caps, which leads to REQUIRES hell, since this header is included all
|
||||
@ -481,6 +483,8 @@ public:
|
||||
|
||||
nsIURI* GetURI() const;
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
// If mURIResolved is false, mURI stores the base URI.
|
||||
// If mURIResolved is true, mURI stores the URI we resolve to; this may be
|
||||
@ -544,7 +548,7 @@ protected:
|
||||
nsCSSValueList* mListDependent;
|
||||
nsCSSValuePairList_heap* mPairList;
|
||||
nsCSSValuePairList* mPairListDependent;
|
||||
} mValue;
|
||||
} mValue;
|
||||
};
|
||||
|
||||
struct nsCSSValue::Array {
|
||||
@ -642,6 +646,8 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
#undef CSSVALUE_LIST_FOR_EXTRA_VALUES
|
||||
|
||||
private:
|
||||
@ -662,6 +668,8 @@ struct nsCSSValueList {
|
||||
bool operator!=(const nsCSSValueList& aOther) const
|
||||
{ return !(*this == aOther); }
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
nsCSSValue mValue;
|
||||
nsCSSValueList* mNext;
|
||||
|
||||
@ -678,6 +686,8 @@ private:
|
||||
// it's an implementation detail of nsCSSValue.
|
||||
struct nsCSSValueList_heap : public nsCSSValueList {
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValueList_heap)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
// This has to be here so that the relationship between nsCSSValueList
|
||||
@ -756,6 +766,8 @@ struct nsCSSRect {
|
||||
// it's an implementation detail of nsCSSValue.
|
||||
struct nsCSSRect_heap : public nsCSSRect {
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSRect_heap)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
// This has to be here so that the relationship between nsCSSRect
|
||||
@ -826,6 +838,8 @@ struct nsCSSValuePair {
|
||||
|
||||
void AppendToString(nsCSSProperty aProperty, nsAString& aResult) const;
|
||||
|
||||
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
nsCSSValue mXValue;
|
||||
nsCSSValue mYValue;
|
||||
};
|
||||
@ -834,12 +848,14 @@ struct nsCSSValuePair {
|
||||
// refcounted. It should not be necessary to use this class directly;
|
||||
// it's an implementation detail of nsCSSValue.
|
||||
struct nsCSSValuePair_heap : public nsCSSValuePair {
|
||||
// forward constructor
|
||||
nsCSSValuePair_heap(const nsCSSValue& aXValue, const nsCSSValue& aYValue)
|
||||
: nsCSSValuePair(aXValue, aYValue)
|
||||
{}
|
||||
// forward constructor
|
||||
nsCSSValuePair_heap(const nsCSSValue& aXValue, const nsCSSValue& aYValue)
|
||||
: nsCSSValuePair(aXValue, aYValue)
|
||||
{}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValuePair_heap)
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValuePair_heap)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
struct nsCSSValueTriplet {
|
||||
@ -916,6 +932,8 @@ struct nsCSSValueTriplet_heap : public nsCSSValueTriplet {
|
||||
{}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValueTriplet_heap)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
// This has to be here so that the relationship between nsCSSValuePair
|
||||
@ -960,6 +978,8 @@ struct nsCSSValuePairList {
|
||||
bool operator!=(const nsCSSValuePairList& aOther) const
|
||||
{ return !(*this == aOther); }
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
nsCSSValue mXValue;
|
||||
nsCSSValue mYValue;
|
||||
nsCSSValuePairList* mNext;
|
||||
@ -977,6 +997,8 @@ private:
|
||||
// it's an implementation detail of nsCSSValue.
|
||||
struct nsCSSValuePairList_heap : public nsCSSValuePairList {
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValuePairList_heap)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
// This has to be here so that the relationship between nsCSSValuePairList
|
||||
@ -1024,6 +1046,8 @@ public:
|
||||
{
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
struct nsCSSValueGradient {
|
||||
@ -1072,6 +1096,8 @@ struct nsCSSValueGradient {
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsCSSValueGradient)
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
nsCSSValueGradient(const nsCSSValueGradient& aOther) MOZ_DELETE;
|
||||
nsCSSValueGradient& operator=(const nsCSSValueGradient& aOther) MOZ_DELETE;
|
||||
|
@ -109,6 +109,8 @@ public:
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
#endif
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheet, NS_ISTYLE_SHEET_IID)
|
||||
|
@ -41,12 +41,30 @@
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(LayoutStyleSheetCacheMallocSizeOf,
|
||||
"layout/style-sheet-cache")
|
||||
|
||||
static PRInt64
|
||||
GetStylesheetCacheSize()
|
||||
{
|
||||
return nsLayoutStylesheetCache::SizeOfIncludingThis(
|
||||
LayoutStyleSheetCacheMallocSizeOf);
|
||||
}
|
||||
|
||||
NS_MEMORY_REPORTER_IMPLEMENT(Sheets,
|
||||
"explicit/layout/style-sheet-cache",
|
||||
KIND_HEAP,
|
||||
nsIMemoryReporter::UNITS_BYTES,
|
||||
GetStylesheetCacheSize,
|
||||
"Memory used for some built-in style sheets.")
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver)
|
||||
|
||||
nsresult
|
||||
@ -172,6 +190,38 @@ nsLayoutStylesheetCache::Shutdown()
|
||||
NS_IF_RELEASE(gStyleCache);
|
||||
}
|
||||
|
||||
size_t
|
||||
nsLayoutStylesheetCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
||||
{
|
||||
if (nsLayoutStylesheetCache::gStyleCache) {
|
||||
return nsLayoutStylesheetCache::gStyleCache->
|
||||
SizeOfIncludingThisHelper(aMallocSizeOf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsLayoutStylesheetCache::SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
|
||||
#define MEASURE(s) n += s ? s->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
|
||||
MEASURE(mScrollbarsSheet);
|
||||
MEASURE(mFormsSheet);
|
||||
MEASURE(mUserContentSheet);
|
||||
MEASURE(mUserChromeSheet);
|
||||
MEASURE(mUASheet);
|
||||
MEASURE(mQuirkSheet);
|
||||
MEASURE(mFullScreenOverrideSheet);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - gCSSLoader
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
nsLayoutStylesheetCache::nsLayoutStylesheetCache()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
@ -208,6 +258,14 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache()
|
||||
}
|
||||
NS_ASSERTION(mFullScreenOverrideSheet, "Could not load full-screen-override.css");
|
||||
|
||||
mSheetsReporter = new NS_MEMORY_REPORTER_NAME(Sheets);
|
||||
(void)::NS_RegisterMemoryReporter(mSheetsReporter);
|
||||
}
|
||||
|
||||
nsLayoutStylesheetCache::~nsLayoutStylesheetCache()
|
||||
{
|
||||
(void)::NS_UnregisterMemoryReporter(mSheetsReporter);
|
||||
mSheetsReporter = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -52,6 +52,8 @@ class Loader;
|
||||
}
|
||||
}
|
||||
|
||||
class nsIMemoryReporter;
|
||||
|
||||
class nsLayoutStylesheetCache
|
||||
: public nsIObserver
|
||||
{
|
||||
@ -68,9 +70,11 @@ class nsLayoutStylesheetCache
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
static size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf);
|
||||
|
||||
private:
|
||||
nsLayoutStylesheetCache();
|
||||
~nsLayoutStylesheetCache() {}
|
||||
~nsLayoutStylesheetCache();
|
||||
|
||||
static void EnsureGlobal();
|
||||
void InitFromProfile();
|
||||
@ -78,6 +82,8 @@ private:
|
||||
static void LoadSheet(nsIURI* aURI, nsRefPtr<nsCSSStyleSheet> &aSheet,
|
||||
bool aEnableUnsafeRules);
|
||||
|
||||
size_t SizeOfIncludingThisHelper(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
static nsLayoutStylesheetCache* gStyleCache;
|
||||
static mozilla::css::Loader* gCSSLoader;
|
||||
nsRefPtr<nsCSSStyleSheet> mScrollbarsSheet;
|
||||
@ -87,6 +93,8 @@ private:
|
||||
nsRefPtr<nsCSSStyleSheet> mUASheet;
|
||||
nsRefPtr<nsCSSStyleSheet> mQuirkSheet;
|
||||
nsRefPtr<nsCSSStyleSheet> mFullScreenOverrideSheet;
|
||||
|
||||
nsIMemoryReporter* mSheetsReporter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -356,7 +356,7 @@ namespace mozilla {
|
||||
* the relevant memory reporter(s).
|
||||
*/
|
||||
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(fn, name) \
|
||||
size_t fn(const void *ptr) \
|
||||
static size_t fn(const void *ptr) \
|
||||
{ \
|
||||
size_t usable = moz_malloc_size_of(ptr); \
|
||||
VALGRIND_DMD_REPORT(ptr, usable, name); \
|
||||
@ -368,7 +368,7 @@ namespace mozilla {
|
||||
* "unreport" message to DMD.
|
||||
*/
|
||||
#define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN_UN(fn) \
|
||||
size_t fn(const void *ptr) \
|
||||
static size_t fn(const void *ptr) \
|
||||
{ \
|
||||
size_t usable = moz_malloc_size_of(ptr); \
|
||||
VALGRIND_DMD_UNREPORT(ptr); \
|
||||
|
Loading…
Reference in New Issue
Block a user