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