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