Bug 1000621 - Check if DMD is enabled before dumping. r=njn. DONTBUILD

This commit is contained in:
Eric Rahm 2014-04-24 12:43:11 -07:00
parent 68cd3b0f84
commit 1058655d11
3 changed files with 14 additions and 0 deletions

View File

@ -2095,6 +2095,12 @@ ClearReports()
ClearReportsInternal();
}
MOZ_EXPORT bool
IsEnabled()
{
return gIsDMDRunning;
}
MOZ_EXPORT void
Dump(Writer aWriter)
{

View File

@ -78,6 +78,10 @@ struct Sizes
MOZ_EXPORT void
SizeOf(Sizes* aSizes);
// Indicates whether or not DMD is enabled.
MOZ_EXPORT bool
IsEnabled();
} // namespace mozilla
} // namespace dmd

View File

@ -516,6 +516,10 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier,
nsresult
nsMemoryInfoDumper::DumpDMD(const nsAString &aIdentifier)
{
if (!dmd::IsEnabled()) {
return NS_OK;
}
nsresult rv;
// Create a filename like dmd-<identifier>-<pid>.txt.gz, which will be used