Bug 1750635: Substitute AppShutdown:IsShuttingDown with equivalent AppShutdown::IsInOrBeyond. r=florian,xpcom-reviewers,nika

Differential Revision: https://phabricator.services.mozilla.com/D139143
This commit is contained in:
Jens Stutte 2022-02-18 19:35:13 +00:00
Родитель b83a6a038f
Коммит 8dc1e5affa
7 изменённых файлов: 15 добавлений и 18 удалений

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

@ -13,7 +13,7 @@ namespace mozilla::gfx {
static cairo_status_t write_func(void* closure, const unsigned char* data,
unsigned int length) {
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return CAIRO_STATUS_SUCCESS;
}
nsCOMPtr<nsIOutputStream> out = reinterpret_cast<nsIOutputStream*>(closure);
@ -65,7 +65,8 @@ nsresult PrintTargetPDF::EndPage() {
}
void PrintTargetPDF::Finish() {
if (mIsFinished || AppShutdown::IsShuttingDown()) {
if (mIsFinished ||
AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
// We don't want to call Close() on mStream more than once, and we don't
// want to block shutdown if for some reason the user shuts down the
// browser mid print.

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

@ -1383,7 +1383,7 @@ void gfxPlatformFontList::StartCmapLoading(uint32_t aGeneration,
if (aGeneration != SharedFontList()->GetGeneration()) {
return;
}
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return;
}
if (mLoadCmapsRunnable) {
@ -2831,7 +2831,7 @@ void gfxPlatformFontList::InitializeFamily(uint32_t aGeneration,
if (list->GetGeneration() != aGeneration) {
return;
}
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return;
}
if (aFamilyIndex >= list->NumFamilies()) {
@ -2855,7 +2855,7 @@ void gfxPlatformFontList::SetCharacterMap(uint32_t aGeneration,
if (list->GetGeneration() != aGeneration) {
return;
}
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return;
}
fontlist::Face* face = static_cast<fontlist::Face*>(aFacePtr.ToPtr(list));
@ -2875,7 +2875,7 @@ void gfxPlatformFontList::SetupFamilyCharMap(
if (list->GetGeneration() != aGeneration) {
return;
}
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return;
}
@ -2931,7 +2931,7 @@ bool gfxPlatformFontList::InitOtherFamilyNames(uint32_t aGeneration,
if (list->GetGeneration() != aGeneration) {
return false;
}
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return false;
}
return InitOtherFamilyNames(aDefer);

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

@ -1940,7 +1940,7 @@ void SaveIntermediateCerts(const nsTArray<nsTArray<uint8_t>>& certList) {
nsCOMPtr<nsIRunnable> importCertsRunnable(NS_NewRunnableFunction(
"IdleSaveIntermediateCerts",
[intermediates = std::move(intermediates)]() -> void {
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return;
}
@ -1954,7 +1954,8 @@ void SaveIntermediateCerts(const nsTArray<nsTArray<uint8_t>>& certList) {
for (CERTCertListNode* node = CERT_LIST_HEAD(intermediates);
!CERT_LIST_END(node, intermediates);
node = CERT_LIST_NEXT(node)) {
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(
ShutdownPhase::AppShutdownConfirmed)) {
return;
}

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

@ -138,7 +138,7 @@ nsresult DataStorage::Init() {
return NS_ERROR_NOT_AVAILABLE;
}
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
// Reject new DataStorage instances if the browser is shutting down. There
// is no guarantee that DataStorage writes will be able to be persisted if
// we init during shutdown, so we return an error here to hopefully make

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

@ -2165,7 +2165,7 @@ void IntermediatePreloadingHealerCallback(nsITimer*, void*) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("IntermediatePreloadingHealerCallback"));
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("Exiting healer due to app shutdown"));
return;
@ -2194,7 +2194,7 @@ void IntermediatePreloadingHealerCallback(nsITimer*, void*) {
// is a preloaded intermediate.
for (CERTCertListNode* n = CERT_LIST_HEAD(softokenCertificates);
!CERT_LIST_END(n, softokenCertificates); n = CERT_LIST_NEXT(n)) {
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("Exiting healer due to app shutdown"));
return;
@ -2246,7 +2246,7 @@ void IntermediatePreloadingHealerCallback(nsITimer*, void*) {
}
}
for (const auto& certToDelete : certsToDelete) {
if (AppShutdown::IsShuttingDown()) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("Exiting healer due to app shutdown"));
return;

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

@ -73,7 +73,6 @@ static nsTerminator* sTerminator = nullptr;
static ShutdownPhase sFastShutdownPhase = ShutdownPhase::NotInShutdown;
static ShutdownPhase sLateWriteChecksPhase = ShutdownPhase::NotInShutdown;
static AppShutdownMode sShutdownMode = AppShutdownMode::Normal;
static Atomic<bool, MemoryOrdering::Relaxed> sIsShuttingDown;
static Atomic<ShutdownPhase> sCurrentShutdownPhase(
ShutdownPhase::NotInShutdown);
static int sExitCode = 0;
@ -104,8 +103,6 @@ ShutdownPhase GetShutdownPhaseFromPrefValue(int32_t aPrefValue) {
return ShutdownPhase::NotInShutdown;
}
bool AppShutdown::IsShuttingDown() { return sIsShuttingDown; }
ShutdownPhase AppShutdown::GetCurrentShutdownPhase() {
return sCurrentShutdownPhase;
}
@ -265,7 +262,6 @@ void AppShutdown::MaybeFastShutdown(ShutdownPhase aPhase) {
}
void AppShutdown::OnShutdownConfirmed() {
sIsShuttingDown = true;
// If we're restarting, we need to save environment variables correctly
// while everything is still alive to do so.
if (sShutdownMode == AppShutdownMode::Restart) {

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

@ -21,7 +21,6 @@ enum class AppShutdownMode {
class AppShutdown {
public:
static bool IsShuttingDown();
static ShutdownPhase GetCurrentShutdownPhase();
static bool IsInOrBeyond(ShutdownPhase aPhase);