Bug 1472495: Don't report shared memmapped cache as explicit memory. r=erahm

MozReview-Commit-ID: 7xWJOdg3mfg

--HG--
extra : rebase_source : 8bb19b94495ae99ec1c4083cd88bd8915003886f
extra : amend_source : e72654de7148415e6999632a0da3f598648685a6
This commit is contained in:
Kris Maglione 2018-06-30 16:33:50 -07:00
parent 0d461a5f71
commit 8ff07d3c3f

View File

@ -89,10 +89,22 @@ ScriptPreloader::CollectReports(nsIHandleReportCallback* aHandleReport,
ShallowHeapSizeOfIncludingThis(MallocSizeOf),
"Memory used by the script cache service itself.");
MOZ_COLLECT_REPORT(
"explicit/script-preloader/non-heap/memmapped-cache", KIND_NONHEAP, UNITS_BYTES,
mCacheData.nonHeapSizeOfExcludingThis(),
"The memory-mapped startup script cache file.");
// Since the mem-mapped cache file is mapped into memory, we want to report
// it as explicit memory somewhere. But since the child cache is shared
// between all processes, we don't want to report it as explicit memory for
// all of them. So we report it as explicit only in the parent process, and
// non-explicit everywhere else.
if (XRE_IsParentProcess()) {
MOZ_COLLECT_REPORT(
"explicit/script-preloader/non-heap/memmapped-cache", KIND_NONHEAP, UNITS_BYTES,
mCacheData.nonHeapSizeOfExcludingThis(),
"The memory-mapped startup script cache file.");
} else {
MOZ_COLLECT_REPORT(
"script-preloader-memmapped-cache", KIND_NONHEAP, UNITS_BYTES,
mCacheData.nonHeapSizeOfExcludingThis(),
"The memory-mapped startup script cache file.");
}
return NS_OK;
}