Bug 1797688 - Part 8: Substitute gXPCOMThreadsShutDown with InOrBeyond(XPCOMShutdownThreads) in IdlePeriodState::GetLocalIdleDeadline. r=xpcom-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D160626
This commit is contained in:
Jens Stutte 2022-11-01 14:08:45 +00:00
parent 48c751b622
commit 3c26de87f1

View File

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/AppShutdown.h"
#include "mozilla/IdlePeriodState.h"
#include "mozilla/StaticPrefs_idle_period.h"
#include "mozilla/ipc/IdleSchedulerChild.h"
@ -108,7 +109,7 @@ TimeStamp IdlePeriodState::GetLocalIdleDeadline(
// gets exhausted at shutdown time to prevent intermittently leaking
// some runnables inside that queue and even worse potentially leaving
// some important cleanup work unfinished.
if (gXPCOMThreadsShutDown ||
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads) ||
nsThreadManager::get().GetCurrentThread()->ShuttingDown()) {
aShuttingDown = true;
return TimeStamp::Now();