Bug 693976 - Don't parse /proc/self/maps once for every entry in /proc/self/smaps. r=khuey

This commit is contained in:
Justin Lebar 2011-10-14 15:05:52 -04:00
parent 4426ead531
commit c7fcd225c6

View File

@ -175,6 +175,7 @@ private:
nsISupports *aClosure, nsISupports *aClosure,
CategoriesSeen *aCategoriesSeen); CategoriesSeen *aCategoriesSeen);
bool mSearchedForLibxul;
nsCString mLibxulDir; nsCString mLibxulDir;
nsCStringHashSet mMozillaLibraries; nsCStringHashSet mMozillaLibraries;
}; };
@ -182,6 +183,7 @@ private:
NS_IMPL_THREADSAFE_ISUPPORTS1(MapsReporter, nsIMemoryMultiReporter) NS_IMPL_THREADSAFE_ISUPPORTS1(MapsReporter, nsIMemoryMultiReporter)
MapsReporter::MapsReporter() MapsReporter::MapsReporter()
: mSearchedForLibxul(false)
{ {
const PRUint32 len = NS_ARRAY_LENGTH(mozillaLibraries); const PRUint32 len = NS_ARRAY_LENGTH(mozillaLibraries);
mMozillaLibraries.Init(len); mMozillaLibraries.Init(len);
@ -233,6 +235,11 @@ MapsReporter::CollectReports(nsIMemoryMultiReporterCallback *aCallback,
nsresult nsresult
MapsReporter::FindLibxul() MapsReporter::FindLibxul()
{ {
if (mSearchedForLibxul)
return NS_OK;
mSearchedForLibxul = true;
mLibxulDir.Truncate(); mLibxulDir.Truncate();
// Note that we're scanning /proc/self/*maps*, not smaps, here. // Note that we're scanning /proc/self/*maps*, not smaps, here.