Bug 957021 - Fix messed-up memory reporter paths. r=khuey.

--HG--
extra : rebase_source : 2bd46a9442c54ffba04279a405aeb270ce7bbb23
This commit is contained in:
Nicholas Nethercote 2014-01-07 17:02:23 -08:00
Родитель ddc5cc6b61
Коммит 0aa47c52fb
2 изменённых файлов: 20 добавлений и 9 удалений

Просмотреть файл

@ -181,7 +181,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
nsIMemoryReporterCallback *aCb,
nsISupports *aClosure)
{
nsAutoCString windowPath;
nsAutoCString windowPath("explicit/");
// Avoid calling aWindow->GetTop() if there's no outer window. It will work
// just fine, but will spew a lot of warnings.
@ -233,20 +233,17 @@ CollectWindowReports(nsGlobalWindow *aWindow,
AppendWindowURI(aWindow, windowPath);
windowPath += NS_LITERAL_CSTRING(")");
nsCString explicitWindowPath("explicit/");
explicitWindowPath += windowPath;
// XXXkhuey
nsCString censusWindowPath("event-counts/");
censusWindowPath += windowPath;
// Use |windowPath|, but replace "explicit/" with "event-counts/".
nsCString censusWindowPath(windowPath);
censusWindowPath.Replace(0, strlen("explicit"), "event-counts");
// Remember the path for later.
aWindowPaths->Put(aWindow->WindowID(), explicitWindowPath);
aWindowPaths->Put(aWindow->WindowID(), windowPath);
#define REPORT_SIZE(_pathTail, _amount, _desc) \
do { \
if (_amount > 0) { \
nsAutoCString path(explicitWindowPath); \
nsAutoCString path(windowPath); \
path += _pathTail; \
nsresult rv; \
rv = aCb->Callback(EmptyCString(), path, nsIMemoryReporter::KIND_HEAP, \

Просмотреть файл

@ -2450,6 +2450,15 @@ class OrphanReporter : public JS::ObjectPrivateVisitor
nsTHashtable <nsISupportsHashKey> mAlreadyMeasuredOrphanTrees;
};
#ifdef DEBUG
static bool
StartsWithExplicit(nsACString& s)
{
const char* e = "explicit/";
return Substring(s, 0, strlen(e)).Equals(e);
}
#endif
class XPCJSRuntimeStats : public JS::RuntimeStats
{
WindowPaths *mWindowPaths;
@ -2498,6 +2507,8 @@ class XPCJSRuntimeStats : public JS::RuntimeStats
extras->pathPrefix += nsPrintfCString("zone(0x%p)/", (void *)zone);
MOZ_ASSERT(StartsWithExplicit(extras->pathPrefix));
zStats->extra = extras;
}
@ -2566,6 +2577,9 @@ class XPCJSRuntimeStats : public JS::RuntimeStats
// be used, because non-nsGlobalWindow compartments shouldn't have
// orphan DOM nodes).
MOZ_ASSERT(StartsWithExplicit(extras->jsPathPrefix));
MOZ_ASSERT(StartsWithExplicit(extras->domPathPrefix));
cstats->extra = extras;
}
};