Remove the Dark Matter Detector (DMD) Memeory debugger component.

This resolves #376.
This commit is contained in:
wolfbeast 2018-05-23 16:31:42 +02:00 committed by Roy Tam
commit 92fbd042f5
55 changed files with 6 additions and 6544 deletions

View file

@ -17,7 +17,7 @@
#include "nsIObserverService.h"
#include "nsIGlobalObject.h"
#include "nsIXPConnect.h"
#if defined(XP_UNIX) || defined(MOZ_DMD)
#if defined(XP_UNIX)
#include "nsMemoryInfoDumper.h"
#endif
#include "mozilla/Attributes.h"
@ -1425,62 +1425,6 @@ NS_IMPL_ISUPPORTS(DeadlockDetectorReporter, nsIMemoryReporter)
#endif
#ifdef MOZ_DMD
namespace mozilla {
namespace dmd {
class DMDReporter final : public nsIMemoryReporter
{
public:
NS_DECL_ISUPPORTS
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize) override
{
dmd::Sizes sizes;
dmd::SizeOf(&sizes);
MOZ_COLLECT_REPORT(
"explicit/dmd/stack-traces/used", KIND_HEAP, UNITS_BYTES,
sizes.mStackTracesUsed,
"Memory used by stack traces which correspond to at least "
"one heap block DMD is tracking.");
MOZ_COLLECT_REPORT(
"explicit/dmd/stack-traces/unused", KIND_HEAP, UNITS_BYTES,
sizes.mStackTracesUnused,
"Memory used by stack traces which don't correspond to any heap "
"blocks DMD is currently tracking.");
MOZ_COLLECT_REPORT(
"explicit/dmd/stack-traces/table", KIND_HEAP, UNITS_BYTES,
sizes.mStackTraceTable,
"Memory used by DMD's stack trace table.");
MOZ_COLLECT_REPORT(
"explicit/dmd/live-block-table", KIND_HEAP, UNITS_BYTES,
sizes.mLiveBlockTable,
"Memory used by DMD's live block table.");
MOZ_COLLECT_REPORT(
"explicit/dmd/dead-block-list", KIND_HEAP, UNITS_BYTES,
sizes.mDeadBlockTable,
"Memory used by DMD's dead block list.");
return NS_OK;
}
private:
~DMDReporter() {}
};
NS_IMPL_ISUPPORTS(DMDReporter, nsIMemoryReporter)
} // namespace dmd
} // namespace mozilla
#endif // MOZ_DMD
/**
** nsMemoryReporterManager implementation
**/
@ -1560,10 +1504,6 @@ nsMemoryReporterManager::Init()
RegisterStrongReporter(new DeadlockDetectorReporter());
#endif
#ifdef MOZ_DMD
RegisterStrongReporter(new mozilla::dmd::DMDReporter());
#endif
#ifdef XP_WIN
RegisterStrongReporter(new WindowsAddressSpaceReporter());
#endif
@ -1679,22 +1619,9 @@ nsMemoryReporterManager::StartGettingReports()
PendingProcessesState* s = mPendingProcessesState;
nsresult rv;
// Get reports for this process.
FILE* parentDMDFile = nullptr;
#ifdef MOZ_DMD
if (!s->mDMDDumpIdent.IsEmpty()) {
rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(),
&parentDMDFile);
if (NS_WARN_IF(NS_FAILED(rv))) {
// Proceed with the memory report as if DMD were disabled.
parentDMDFile = nullptr;
}
}
#endif
// This is async.
GetReportsForThisProcessExtended(s->mHandleReport, s->mHandleReportData,
s->mAnonymize, parentDMDFile,
s->mAnonymize, nullptr,
s->mFinishReporting, s->mFinishReportingData);
nsTArray<ContentParent*> childWeakRefs;
@ -1775,16 +1702,6 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended(
return NS_ERROR_IN_PROGRESS;
}
#ifdef MOZ_DMD
if (aDMDFile) {
// Clear DMD's reportedness state before running the memory
// reporters, to avoid spurious twice-reported warnings.
dmd::ClearReports();
}
#else
MOZ_ASSERT(!aDMDFile);
#endif
mPendingReportersState = new PendingReportersState(
aFinishReporting, aFinishReportingData, aDMDFile);
@ -1810,11 +1727,6 @@ NS_IMETHODIMP
nsMemoryReporterManager::EndReport()
{
if (--mPendingReportersState->mReportsPending == 0) {
#ifdef MOZ_DMD
if (mPendingReportersState->mDMDFile) {
nsMemoryInfoDumper::DumpDMDToFile(mPendingReportersState->mDMDFile);
}
#endif
if (mPendingProcessesState) {
// This is the parent process.
EndProcessReport(mPendingProcessesState->mGeneration, true);
@ -1902,24 +1814,8 @@ nsMemoryReporterManager::StartChildReport(mozilla::dom::ContentParent* aChild,
return false;
}
mozilla::dom::MaybeFileDesc dmdFileDesc = void_t();
#ifdef MOZ_DMD
if (!aState->mDMDDumpIdent.IsEmpty()) {
FILE *dmdFile = nullptr;
nsresult rv = nsMemoryInfoDumper::OpenDMDFile(aState->mDMDDumpIdent,
aChild->Pid(), &dmdFile);
if (NS_WARN_IF(NS_FAILED(rv))) {
// Proceed with the memory report as if DMD were disabled.
dmdFile = nullptr;
}
if (dmdFile) {
dmdFileDesc = mozilla::ipc::FILEToFileDescriptor(dmdFile);
fclose(dmdFile);
}
}
#endif
return aChild->SendPMemoryReportRequestConstructor(
aState->mGeneration, aState->mAnonymize, aState->mMinimize, dmdFileDesc);
aState->mGeneration, aState->mAnonymize, aState->mMinimize, void_t());
}
void
@ -2452,28 +2348,6 @@ nsMemoryReporterManager::GetHasMozMallocUsableSize(bool* aHas)
return NS_OK;
}
NS_IMETHODIMP
nsMemoryReporterManager::GetIsDMDEnabled(bool* aIsEnabled)
{
#ifdef MOZ_DMD
*aIsEnabled = true;
#else
*aIsEnabled = false;
#endif
return NS_OK;
}
NS_IMETHODIMP
nsMemoryReporterManager::GetIsDMDRunning(bool* aIsRunning)
{
#ifdef MOZ_DMD
*aIsRunning = dmd::IsRunning();
#else
*aIsRunning = false;
#endif
return NS_OK;
}
namespace {
/**