зеркало из https://github.com/mozilla/gecko-dev.git
Bug 800166 - Fire a low-memory notification when a B2G process is backgrounded. r=gwagner,bent
This commit is contained in:
Родитель
6308bec76a
Коммит
46036e9207
|
@ -298,6 +298,13 @@ ProcessPriorityManager::OnGracePeriodTimerFired()
|
||||||
|
|
||||||
mGracePeriodTimer = nullptr;
|
mGracePeriodTimer = nullptr;
|
||||||
hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_BACKGROUND);
|
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
|
} // 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
|
* 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);
|
void minimizeMemoryUsage(in nsIRunnable callback);
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче