From 55c4f8b84720d9222975966567ae23ec15587fe6 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 2 Dec 2013 12:51:26 -0500 Subject: [PATCH] Bug 945046 - Move private, vsize-max-contiguous class implementation under their own ifdef. r=njn --- xpcom/base/nsMemoryReporterManager.cpp | 37 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index b8147c8bf31..812f2928fb8 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -416,6 +416,25 @@ VsizeMaxContiguousDistinguishedAmount(int64_t* aN) return NS_OK; } +#define HAVE_PRIVATE_REPORTER +static nsresult +PrivateDistinguishedAmount(int64_t* aN) +{ + PROCESS_MEMORY_COUNTERS_EX pmcex; + pmcex.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX); + + if (!GetProcessMemoryInfo( + GetCurrentProcess(), + (PPROCESS_MEMORY_COUNTERS) &pmcex, sizeof(pmcex))) { + return NS_ERROR_FAILURE; + } + + *aN = pmcex.PrivateUsage; + return NS_OK; +} +#endif // XP_ + +#ifdef HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER class VsizeMaxContiguousReporter MOZ_FINAL : public MemoryUniReporter { public: @@ -429,8 +448,9 @@ public: return VsizeMaxContiguousDistinguishedAmount(aAmount); } }; +#endif -#define HAVE_PRIVATE_REPORTER +#ifdef HAVE_PRIVATE_REPORTER class PrivateReporter MOZ_FINAL : public MemoryUniReporter { public: @@ -443,21 +463,10 @@ public: NS_IMETHOD GetAmount(int64_t* aAmount) { - PROCESS_MEMORY_COUNTERS_EX pmcex; - pmcex.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX); - - if (!GetProcessMemoryInfo( - GetCurrentProcess(), - (PPROCESS_MEMORY_COUNTERS) &pmcex, sizeof(pmcex))) { - return NS_ERROR_FAILURE; - } - - *aAmount = pmcex.PrivateUsage; - return NS_OK; + return PrivateDistinguishedAmount(aAmount); } }; - -#endif // XP_ +#endif #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS class VsizeReporter MOZ_FINAL : public MemoryUniReporter