2013-01-15 04:28:36 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
|
|
|
|
2008-03-06 04:28:25 +03:00
|
|
|
#include "nsIMemoryReporter.h"
|
2010-12-15 20:47:16 +03:00
|
|
|
#include "mozilla/Mutex.h"
|
2013-02-01 19:12:52 +04:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2010-12-15 20:47:16 +03:00
|
|
|
|
|
|
|
using mozilla::Mutex;
|
2008-03-06 04:28:25 +03:00
|
|
|
|
|
|
|
class nsMemoryReporterManager : public nsIMemoryReporterManager
|
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:31:26 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2013-01-15 04:28:36 +04:00
|
|
|
NS_DECL_NSIMEMORYREPORTERMANAGER
|
2008-03-06 04:28:25 +03:00
|
|
|
|
2013-01-15 04:28:36 +04:00
|
|
|
nsMemoryReporterManager();
|
|
|
|
virtual ~nsMemoryReporterManager();
|
2010-12-15 20:47:16 +03:00
|
|
|
|
2013-09-20 02:52:28 +04:00
|
|
|
// Functions that (a) implement distinguished amounts, and (b) are outside of
|
|
|
|
// this module.
|
|
|
|
struct AmountFns {
|
|
|
|
mozilla::InfallibleAmountFn mJSMainRuntimeCompartmentsSystem;
|
|
|
|
mozilla::InfallibleAmountFn mJSMainRuntimeCompartmentsUser;
|
|
|
|
};
|
|
|
|
AmountFns mAmountFns;
|
|
|
|
|
2008-03-06 04:28:25 +03:00
|
|
|
private:
|
2013-09-20 02:52:28 +04:00
|
|
|
nsresult RegisterReporterHelper(nsIMemoryReporter *aReporter, bool aForce);
|
2013-04-02 08:39:44 +04:00
|
|
|
|
2013-02-01 19:12:52 +04:00
|
|
|
nsTHashtable<nsISupportsHashKey> mReporters;
|
|
|
|
Mutex mMutex;
|
2013-04-02 08:39:44 +04:00
|
|
|
bool mIsRegistrationBlocked;
|
2008-03-06 04:28:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NS_MEMORY_REPORTER_MANAGER_CID \
|
|
|
|
{ 0xfb97e4f5, 0x32dd, 0x497a, \
|
|
|
|
{ 0xba, 0xa2, 0x7d, 0x1e, 0x55, 0x7, 0x99, 0x10 } }
|