mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1027921 - Part 9: Add DeadlockDetector memory reporter. r=njn, r=froydnj
This commit is contained in:
parent
9961766b9d
commit
4d0205fb6f
@ -883,6 +883,34 @@ public:
|
||||
};
|
||||
NS_IMPL_ISUPPORTS(AtomTablesReporter, nsIMemoryReporter)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
// Ideally, this would be implemented in BlockingResourceBase.cpp.
|
||||
// However, this ends up breaking the linking step of various unit tests due
|
||||
// to adding a new dependency to libdmd for a commonly used feature (mutexes)
|
||||
// in DMD builds. So instead we do it here.
|
||||
class DeadlockDetectorReporter MOZ_FINAL : public nsIMemoryReporter
|
||||
{
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
|
||||
|
||||
~DeadlockDetectorReporter() {}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
|
||||
nsISupports* aData, bool aAnonymize)
|
||||
{
|
||||
return MOZ_COLLECT_REPORT(
|
||||
"explicit/deadlock-detector", KIND_HEAP, UNITS_BYTES,
|
||||
BlockingResourceBase::SizeOfDeadlockDetector(MallocSizeOf),
|
||||
"Memory used by the deadlock detector.");
|
||||
}
|
||||
};
|
||||
NS_IMPL_ISUPPORTS(DeadlockDetectorReporter, nsIMemoryReporter)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DMD
|
||||
|
||||
namespace mozilla {
|
||||
@ -986,6 +1014,10 @@ nsMemoryReporterManager::Init()
|
||||
|
||||
RegisterStrongReporter(new AtomTablesReporter());
|
||||
|
||||
#ifdef DEBUG
|
||||
RegisterStrongReporter(new DeadlockDetectorReporter());
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DMD
|
||||
RegisterStrongReporter(new mozilla::dmd::DMDReporter());
|
||||
#endif
|
||||
|
@ -269,7 +269,12 @@ public:
|
||||
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mOrdering.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOf);
|
||||
|
||||
{
|
||||
PRAutoLock _(mLock);
|
||||
n += mOrdering.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOf);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -129,3 +129,8 @@ USE_LIBS += [
|
||||
'xpcomglue_s',
|
||||
'xul',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_DMD']:
|
||||
USE_LIBS += [
|
||||
'dmd'
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user