Bug 633305 - about:memory should display memory reporters that live in the child process r=cjones a=blocking-fennec

This commit is contained in:
Doug Turner
2011-02-16 10:43:23 -08:00
parent c13dfd5da8
commit 54b27cd18d
11 changed files with 329 additions and 5 deletions

View File

@@ -288,6 +288,45 @@ nsMemoryReporterManager::UnregisterReporter(nsIMemoryReporter *reporter)
return NS_OK;
}
NS_IMPL_ISUPPORTS1(nsMemoryReporter, nsIMemoryReporter)
nsMemoryReporter::nsMemoryReporter(nsCString& prefix,
nsCString& path,
nsCString& desc,
PRInt64 memoryUsed)
: mDesc(desc)
, mMemoryUsed(memoryUsed)
{
if (!prefix.IsEmpty()) {
mPath.Append(prefix);
mPath.Append(NS_LITERAL_CSTRING(" - "));
}
mPath.Append(path);
}
nsMemoryReporter::~nsMemoryReporter()
{
}
NS_IMETHODIMP nsMemoryReporter::GetPath(char **aPath)
{
*aPath = strdup(mPath.get());
return NS_OK;
}
NS_IMETHODIMP nsMemoryReporter::GetDescription(char **aDescription)
{
*aDescription = strdup(mDesc.get());
return NS_OK;
}
NS_IMETHODIMP nsMemoryReporter::GetMemoryUsed(PRInt64 *aMemoryUsed)
{
*aMemoryUsed = mMemoryUsed;
return NS_OK;
}
NS_COM nsresult
NS_RegisterMemoryReporter (nsIMemoryReporter *reporter)
{