Bug 1620623 - Ignore memory-pressure if we've begun to shut down. r=smaug

If we're in the middle of shutting down a content process, don't GC if we get a
memory pressure event. Shutting down the process is a better way to free memory!
This doesn't seem to happen much, presumably because once we've started
shutting down the content process we ignore new messages, like ones telling
us to do memory-pressure.

Differential Revision: https://phabricator.services.mozilla.com/D65755

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2020-03-06 20:57:08 +00:00
Родитель 93ef1bd928
Коммит d5d2276a11
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -383,6 +383,10 @@ nsJSEnvironmentObserver::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
if (!nsCRT::strcmp(aTopic, "memory-pressure")) {
if (StaticPrefs::javascript_options_gc_on_memory_pressure()) {
if (sShuttingDown) {
// Don't GC/CC if we're already shutting down.
return NS_OK;
}
nsDependentString data(aData);
if (data.EqualsLiteral("low-memory-ongoing")) {
// Don't GC/CC if we are in an ongoing low-memory state since its very