2012-05-21 04:12:37 -07: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-05 17:28:25 -08:00
|
|
|
|
|
|
|
#include "nsIMemoryReporter.h"
|
|
|
|
#include "nsCOMArray.h"
|
2010-12-15 09:47:16 -08:00
|
|
|
#include "mozilla/Mutex.h"
|
2011-10-28 00:35:45 -07:00
|
|
|
#include "nsString.h"
|
2010-12-15 09:47:16 -08:00
|
|
|
|
|
|
|
using mozilla::Mutex;
|
2008-03-05 17:28:25 -08:00
|
|
|
|
2011-02-16 10:43:23 -08:00
|
|
|
class nsMemoryReporter : public nsIMemoryReporter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIMEMORYREPORTER
|
|
|
|
|
2011-07-07 19:45:16 -07:00
|
|
|
nsMemoryReporter(nsACString& process,
|
|
|
|
nsACString& path,
|
2011-05-22 19:49:56 -07:00
|
|
|
PRInt32 kind,
|
2011-06-16 11:34:09 -07:00
|
|
|
PRInt32 units,
|
|
|
|
PRInt64 amount,
|
2011-07-07 19:45:16 -07:00
|
|
|
nsACString& desc);
|
2011-02-16 10:43:23 -08:00
|
|
|
|
|
|
|
~nsMemoryReporter();
|
|
|
|
|
|
|
|
protected:
|
2011-06-05 18:22:45 -07:00
|
|
|
nsCString mProcess;
|
2011-05-24 03:35:10 -07:00
|
|
|
nsCString mPath;
|
|
|
|
PRInt32 mKind;
|
2011-06-16 11:34:09 -07:00
|
|
|
PRInt32 mUnits;
|
|
|
|
PRInt64 mAmount;
|
2011-05-24 03:35:10 -07:00
|
|
|
nsCString mDesc;
|
2011-02-16 10:43:23 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-05 17:28:25 -08:00
|
|
|
class nsMemoryReporterManager : public nsIMemoryReporterManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIMEMORYREPORTERMANAGER
|
|
|
|
|
2010-12-15 09:47:16 -08:00
|
|
|
nsMemoryReporterManager();
|
|
|
|
virtual ~nsMemoryReporterManager();
|
|
|
|
|
2008-03-05 17:28:25 -08:00
|
|
|
private:
|
2011-06-29 16:39:32 -07:00
|
|
|
nsCOMArray<nsIMemoryReporter> mReporters;
|
|
|
|
nsCOMArray<nsIMemoryMultiReporter> mMultiReporters;
|
|
|
|
Mutex mMutex;
|
2008-03-05 17:28:25 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NS_MEMORY_REPORTER_MANAGER_CID \
|
|
|
|
{ 0xfb97e4f5, 0x32dd, 0x497a, \
|
|
|
|
{ 0xba, 0xa2, 0x7d, 0x1e, 0x55, 0x7, 0x99, 0x10 } }
|