/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ #ifndef nsWindowMemoryReporter_h__ #define nsWindowMemoryReporter_h__ #include "nsIMemoryReporter.h" #include "nsIObserver.h" #include "nsDataHashtable.h" #include "nsWeakReference.h" #include "nsAutoPtr.h" #include "mozilla/TimeStamp.h" #include "nsArenaMemoryStats.h" // This should be used for any nsINode sub-class that has fields of its own // that it needs to measure; any sub-class that doesn't use it will inherit // 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; class nsWindowSizes { public: nsWindowSizes(nsMallocSizeOfFun aMallocSizeOf) { memset(this, 0, sizeof(nsWindowSizes)); mMallocSizeOf = aMallocSizeOf; } nsMallocSizeOfFun mMallocSizeOf; nsArenaMemoryStats mArenaStats; size_t mDOMElementNodes; size_t mDOMTextNodes; size_t mDOMCDATANodes; size_t mDOMCommentNodes; size_t mDOMOther; size_t mStyleSheets; size_t mLayoutPresShell; size_t mLayoutStyleSets; size_t mLayoutTextRuns; size_t mLayoutPresContext; }; /** * nsWindowMemoryReporter is responsible for the 'explicit/window-objects' * memory reporter. * * We classify DOM window objects into one of three categories: * * - "active" windows, which are displayed in a tab (as the top-level window * or an iframe), * * - "cached" windows, which are in the fastback cache (aka the bfcache), and * * - "detached" windows, which have a null docshell. A window becomes * detached when its