1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsArenaMemoryStats_h
8 #define nsArenaMemoryStats_h
10 #include "mozilla/Assertions.h"
11 #include "mozilla/PodOperations.h"
17 Style
, // Style stuff.
18 Other
// Everything else.
21 nsTabSizes() { mozilla::PodZero(this); }
23 void add(Kind kind
, size_t n
)
26 case DOM
: mDom
+= n
; break;
27 case Style
: mStyle
+= n
; break;
28 case Other
: mOther
+= n
; break;
29 default: MOZ_CRASH("bad nsTabSizes kind");
38 #define FRAME_ID_STAT_FIELD(classname) mArena##classname
40 struct nsArenaMemoryStats
{
41 #define FOR_EACH_SIZE(macro) \
42 macro(Other, mLineBoxes) \
43 macro(Style, mRuleNodes) \
44 macro(Style, mStyleContexts) \
49 #define ZERO_SIZE(kind, mSize) mSize(0),
50 FOR_EACH_SIZE(ZERO_SIZE
)
52 #define FRAME_ID(classname) FRAME_ID_STAT_FIELD(classname)(),
53 #include "nsFrameIdList.h"
58 void addToTabSizes(nsTabSizes
*sizes
) const
60 #define ADD_TO_TAB_SIZES(kind, mSize) sizes->add(nsTabSizes::kind, mSize);
61 FOR_EACH_SIZE(ADD_TO_TAB_SIZES
)
62 #undef ADD_TO_TAB_SIZES
63 #define FRAME_ID(classname) \
64 sizes->add(nsTabSizes::Other, FRAME_ID_STAT_FIELD(classname));
65 #include "nsFrameIdList.h"
69 size_t getTotalSize() const
72 #define ADD_TO_TOTAL_SIZE(kind, mSize) total += mSize;
73 FOR_EACH_SIZE(ADD_TO_TOTAL_SIZE
)
74 #undef ADD_TO_TOTAL_SIZE
75 #define FRAME_ID(classname) \
76 total += FRAME_ID_STAT_FIELD(classname);
77 #include "nsFrameIdList.h"
82 #define DECL_SIZE(kind, mSize) size_t mSize;
83 FOR_EACH_SIZE(DECL_SIZE
)
85 #define FRAME_ID(classname) size_t FRAME_ID_STAT_FIELD(classname);
86 #include "nsFrameIdList.h"
88 int dummy
; // present just to absorb the trailing comma from FRAME_ID in the
94 #endif // nsArenaMemoryStats_h