Bug 800166 - Fire a low-memory notification when a B2G process is backgrounded. r=gwagner,bent

This commit is contained in:
Justin Lebar 2012-10-22 15:40:19 -04:00
parent 70206b30d9
commit ed7f6604e2
2 changed files with 9 additions and 1 deletions

View File

@ -298,6 +298,13 @@ ProcessPriorityManager::OnGracePeriodTimerFired()
mGracePeriodTimer = nullptr;
hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_BACKGROUND);
// We're in the background; dump as much memory as we can.
nsCOMPtr<nsIMemoryReporterManager> mgr =
do_GetService("@mozilla.org/memory-reporter-manager;1");
if (mgr) {
mgr->MinimizeMemoryUsage(/* callback = */ nullptr);
}
}
} // anonymous namespace

View File

@ -295,7 +295,8 @@ interface nsIMemoryReporterManager : nsISupports
/*
* 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.
* usage. When we're finished, we invoke the given runnable if it's not
* null.
*/
void minimizeMemoryUsage(in nsIRunnable callback);
};