2013-01-14 16:28:36 -08: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 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"
|
2010-12-15 09:47:16 -08:00
|
|
|
#include "mozilla/Mutex.h"
|
2012-06-05 16:51:58 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-10-28 00:35:45 -07:00
|
|
|
#include "nsString.h"
|
2013-02-01 07:12:52 -08:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2010-12-15 09:47:16 -08:00
|
|
|
|
|
|
|
using mozilla::Mutex;
|
2008-03-05 17:28:25 -08:00
|
|
|
|
|
|
|
class nsMemoryReporterManager : public nsIMemoryReporterManager
|
|
|
|
{
|
|
|
|
public:
|
2013-07-18 19:31:26 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2013-01-14 16:28:36 -08:00
|
|
|
NS_DECL_NSIMEMORYREPORTERMANAGER
|
2008-03-05 17:28:25 -08:00
|
|
|
|
2013-01-14 16:28:36 -08:00
|
|
|
nsMemoryReporterManager();
|
|
|
|
virtual ~nsMemoryReporterManager();
|
2010-12-15 09:47:16 -08:00
|
|
|
|
2008-03-05 17:28:25 -08:00
|
|
|
private:
|
2013-04-01 21:39:44 -07:00
|
|
|
nsresult RegisterReporterHelper(nsIMemoryReporter *reporter, bool aForce);
|
|
|
|
|
2013-02-01 07:12:52 -08:00
|
|
|
nsTHashtable<nsISupportsHashKey> mReporters;
|
|
|
|
Mutex mMutex;
|
2013-04-01 21:39:44 -07:00
|
|
|
bool mIsRegistrationBlocked;
|
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 } }
|