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
Родитель 6308bec76a
Коммит 46036e9207
2 изменённых файлов: 9 добавлений и 1 удалений

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

@ -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

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

@ -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);
};