mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1027921 - Part 9: Add DeadlockDetector memory reporter. r=njn, r=froydnj
This commit is contained in:
parent
46fb43fd6a
commit
310f223358
@ -883,6 +883,34 @@ public:
|
|||||||
};
|
};
|
||||||
NS_IMPL_ISUPPORTS(AtomTablesReporter, nsIMemoryReporter)
|
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
|
#ifdef MOZ_DMD
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -986,6 +1014,10 @@ nsMemoryReporterManager::Init()
|
|||||||
|
|
||||||
RegisterStrongReporter(new AtomTablesReporter());
|
RegisterStrongReporter(new AtomTablesReporter());
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
RegisterStrongReporter(new DeadlockDetectorReporter());
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_DMD
|
#ifdef MOZ_DMD
|
||||||
RegisterStrongReporter(new mozilla::dmd::DMDReporter());
|
RegisterStrongReporter(new mozilla::dmd::DMDReporter());
|
||||||
#endif
|
#endif
|
||||||
|
@ -269,7 +269,12 @@ public:
|
|||||||
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
size_t n = aMallocSizeOf(this);
|
size_t n = aMallocSizeOf(this);
|
||||||
n += mOrdering.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOf);
|
|
||||||
|
{
|
||||||
|
PRAutoLock _(mLock);
|
||||||
|
n += mOrdering.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOf);
|
||||||
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,3 +129,8 @@ USE_LIBS += [
|
|||||||
'xpcomglue_s',
|
'xpcomglue_s',
|
||||||
'xul',
|
'xul',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_DMD']:
|
||||||
|
USE_LIBS += [
|
||||||
|
'dmd'
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user