Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsArenaMemoryStats_h |
michael@0 | 8 | #define nsArenaMemoryStats_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/Assertions.h" |
michael@0 | 11 | #include "mozilla/PodOperations.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsTabSizes { |
michael@0 | 14 | public: |
michael@0 | 15 | enum Kind { |
michael@0 | 16 | DOM, // DOM stuff. |
michael@0 | 17 | Style, // Style stuff. |
michael@0 | 18 | Other // Everything else. |
michael@0 | 19 | }; |
michael@0 | 20 | |
michael@0 | 21 | nsTabSizes() { mozilla::PodZero(this); } |
michael@0 | 22 | |
michael@0 | 23 | void add(Kind kind, size_t n) |
michael@0 | 24 | { |
michael@0 | 25 | switch (kind) { |
michael@0 | 26 | case DOM: mDom += n; break; |
michael@0 | 27 | case Style: mStyle += n; break; |
michael@0 | 28 | case Other: mOther += n; break; |
michael@0 | 29 | default: MOZ_CRASH("bad nsTabSizes kind"); |
michael@0 | 30 | } |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | size_t mDom; |
michael@0 | 34 | size_t mStyle; |
michael@0 | 35 | size_t mOther; |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | #define FRAME_ID_STAT_FIELD(classname) mArena##classname |
michael@0 | 39 | |
michael@0 | 40 | struct nsArenaMemoryStats { |
michael@0 | 41 | #define FOR_EACH_SIZE(macro) \ |
michael@0 | 42 | macro(Other, mLineBoxes) \ |
michael@0 | 43 | macro(Style, mRuleNodes) \ |
michael@0 | 44 | macro(Style, mStyleContexts) \ |
michael@0 | 45 | macro(Other, mOther) |
michael@0 | 46 | |
michael@0 | 47 | nsArenaMemoryStats() |
michael@0 | 48 | : |
michael@0 | 49 | #define ZERO_SIZE(kind, mSize) mSize(0), |
michael@0 | 50 | FOR_EACH_SIZE(ZERO_SIZE) |
michael@0 | 51 | #undef ZERO_SIZE |
michael@0 | 52 | #define FRAME_ID(classname) FRAME_ID_STAT_FIELD(classname)(), |
michael@0 | 53 | #include "nsFrameIdList.h" |
michael@0 | 54 | #undef FRAME_ID |
michael@0 | 55 | dummy() |
michael@0 | 56 | {} |
michael@0 | 57 | |
michael@0 | 58 | void addToTabSizes(nsTabSizes *sizes) const |
michael@0 | 59 | { |
michael@0 | 60 | #define ADD_TO_TAB_SIZES(kind, mSize) sizes->add(nsTabSizes::kind, mSize); |
michael@0 | 61 | FOR_EACH_SIZE(ADD_TO_TAB_SIZES) |
michael@0 | 62 | #undef ADD_TO_TAB_SIZES |
michael@0 | 63 | #define FRAME_ID(classname) \ |
michael@0 | 64 | sizes->add(nsTabSizes::Other, FRAME_ID_STAT_FIELD(classname)); |
michael@0 | 65 | #include "nsFrameIdList.h" |
michael@0 | 66 | #undef FRAME_ID |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | #define DECL_SIZE(kind, mSize) size_t mSize; |
michael@0 | 70 | FOR_EACH_SIZE(DECL_SIZE) |
michael@0 | 71 | #undef DECL_SIZE |
michael@0 | 72 | #define FRAME_ID(classname) size_t FRAME_ID_STAT_FIELD(classname); |
michael@0 | 73 | #include "nsFrameIdList.h" |
michael@0 | 74 | #undef FRAME_ID |
michael@0 | 75 | int dummy; // present just to absorb the trailing comma from FRAME_ID in the |
michael@0 | 76 | // constructor |
michael@0 | 77 | |
michael@0 | 78 | #undef FOR_EACH_SIZE |
michael@0 | 79 | }; |
michael@0 | 80 | |
michael@0 | 81 | #endif // nsArenaMemoryStats_h |