Bug 1375281 - Part 1: Add getHeapAllocatedAsync() to nsIMemoryReporter.idl. r=erahm

nsIMemoryReporter::getHeapAllocatedAsync() is added to get attribute
'heapAllocated' asynchronously.

MozReview-Commit-ID: 96KyZpCeTG1

--HG--
extra : rebase_source : 5c27b26788a3a96821ce054911dda8ce2932007d
extra : amend_source : fcb923dac2dfa9d7aa5bf520d38c5bb11f0d60e9
extra : histedit_source : 83ae65c153f7cef6c6529296838a9d9aa367219e
This commit is contained in:
Cervantes Yu 2017-07-06 11:19:32 +08:00
parent e171eb9a00
commit 9b7ab955c8
2 changed files with 18 additions and 0 deletions

View File

@ -205,6 +205,12 @@ interface nsIFinishReportingCallback : nsISupports
void callback(in nsISupports data); void callback(in nsISupports data);
}; };
[scriptable, function, uuid(1a80cd0f-0d9e-4397-be69-68ad28fe5175)]
interface nsIHeapAllocatedCallback : nsISupports
{
void callback(in int64_t bytesAllocated);
};
[scriptable, builtinclass, uuid(2998574d-8993-407a-b1a5-8ad7417653e1)] [scriptable, builtinclass, uuid(2998574d-8993-407a-b1a5-8ad7417653e1)]
interface nsIMemoryReporterManager : nsISupports interface nsIMemoryReporterManager : nsISupports
{ {
@ -411,6 +417,12 @@ interface nsIMemoryReporterManager : nsISupports
[infallible] readonly attribute boolean isDMDEnabled; [infallible] readonly attribute boolean isDMDEnabled;
[infallible] readonly attribute boolean isDMDRunning; [infallible] readonly attribute boolean isDMDRunning;
/*
* Asynchronously gets attribute 'heapAllocated'. The value is returned in
* the callback argument.
*/
[must_use] void getHeapAllocatedAsync(in nsIHeapAllocatedCallback callback);
/* /*
* Run a series of GC/CC's in an attempt to minimize the application's memory * Run a series of GC/CC's in an attempt to minimize the application's memory
* usage. When we're finished, we invoke the given runnable if it's not * usage. When we're finished, we invoke the given runnable if it's not

View File

@ -2373,6 +2373,12 @@ nsMemoryReporterManager::GetHeapAllocated(int64_t* aAmount)
#endif #endif
} }
NS_IMETHODIMP
nsMemoryReporterManager::GetHeapAllocatedAsync(nsIHeapAllocatedCallback *aCallback)
{
return NS_ERROR_NOT_AVAILABLE;
}
// This has UNITS_PERCENTAGE, so it is multiplied by 100x. // This has UNITS_PERCENTAGE, so it is multiplied by 100x.
NS_IMETHODIMP NS_IMETHODIMP
nsMemoryReporterManager::GetHeapOverheadFraction(int64_t* aAmount) nsMemoryReporterManager::GetHeapOverheadFraction(int64_t* aAmount)