diff options
Diffstat (limited to 'xpcom/base/nsMemoryInfoDumper.cpp')
-rw-r--r-- | xpcom/base/nsMemoryInfoDumper.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 06453b126..afb18382d 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -766,65 +766,3 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, aAnonymize, aMinimizeMemoryUsage, identifier); } -#ifdef MOZ_DMD -dmd::DMDFuncs::Singleton dmd::DMDFuncs::sSingleton; - -nsresult -nsMemoryInfoDumper::OpenDMDFile(const nsAString& aIdentifier, int aPid, - FILE** aOutFile) -{ - if (!dmd::IsRunning()) { - *aOutFile = nullptr; - return NS_OK; - } - - // Create a filename like dmd-<identifier>-<pid>.json.gz, which will be used - // if DMD is enabled. - nsCString dmdFilename; - MakeFilename("dmd", aIdentifier, aPid, "json.gz", dmdFilename); - - // Open a new DMD file named |dmdFilename| in NS_OS_TEMP_DIR for writing, - // and dump DMD output to it. This must occur after the memory reporters - // have been run (above), but before the memory-reports file has been - // renamed (so scripts can detect the DMD file, if present). - - nsresult rv; - nsCOMPtr<nsIFile> dmdFile; - rv = nsDumpUtils::OpenTempFile(dmdFilename, - getter_AddRefs(dmdFile), - NS_LITERAL_CSTRING("memory-reports")); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - rv = dmdFile->OpenANSIFileDesc("wb", aOutFile); - NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "OpenANSIFileDesc failed"); - - // Print the path, because on some platforms (e.g. Mac) it's not obvious. - nsCString path; - rv = dmdFile->GetNativePath(path); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - dmd::StatusMsg("opened %s for writing\n", path.get()); - - return rv; -} - -nsresult -nsMemoryInfoDumper::DumpDMDToFile(FILE* aFile) -{ - RefPtr<nsGZFileWriter> gzWriter = new nsGZFileWriter(); - nsresult rv = gzWriter->InitANSIFileDesc(aFile); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - // Dump DMD's memory reports analysis to the file. - dmd::Analyze(MakeUnique<GZWriterWrapper>(gzWriter)); - - rv = gzWriter->Finish(); - NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Finish failed"); - return rv; -} -#endif // MOZ_DMD - |