mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1791350
- Replace C++ uses of Services.startup.shuttingDown with appropriate AppShutdown::IsInOrBeyond. r=florian
Differential Revision: https://phabricator.services.mozilla.com/D157628
This commit is contained in:
parent
3557a0e284
commit
8e845bcd74
@ -27,8 +27,8 @@
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIResProtocolHandler.h"
|
||||
@ -203,8 +203,7 @@ nsChromeRegistryChrome::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeRegistryChrome::CheckForNewChrome() {
|
||||
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
|
||||
if (appStartup->GetShuttingDown()) {
|
||||
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
|
||||
MOZ_ASSERT(false, "checking for new chrome during shutdown");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/ProfilerLabels.h"
|
||||
@ -71,11 +72,8 @@ WindowDestroyedEvent::Run() {
|
||||
case Phase::Destroying: {
|
||||
bool skipNukeCrossCompartment = false;
|
||||
#ifndef DEBUG
|
||||
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
|
||||
|
||||
if (appStartup) {
|
||||
appStartup->GetShuttingDown(&skipNukeCrossCompartment);
|
||||
}
|
||||
skipNukeCrossCompartment =
|
||||
AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed);
|
||||
#endif
|
||||
|
||||
if (!skipNukeCrossCompartment) {
|
||||
|
@ -190,7 +190,6 @@
|
||||
#include "nsHyphenationManager.h"
|
||||
#include "nsIAlertsService.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIAppWindow.h"
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIBidiKeyboard.h"
|
||||
@ -4280,8 +4279,8 @@ void ContentParent::GeneratePairedMinidump(const char* aReason) {
|
||||
// Something has gone wrong to get us here, so we generate a minidump
|
||||
// of the parent and child for submission to the crash server unless we're
|
||||
// already shutting down.
|
||||
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
|
||||
if (mCrashReporter && !appStartup->GetShuttingDown() &&
|
||||
if (mCrashReporter &&
|
||||
!AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed) &&
|
||||
StaticPrefs::dom_ipc_tabs_createKillHardCrashReports_AtStartup()) {
|
||||
// GeneratePairedMinidump creates two minidumps for us - the main
|
||||
// one is for the content process we're about to kill, and the other
|
||||
|
@ -194,6 +194,9 @@ interface nsIAppStartup : nsISupports
|
||||
|
||||
/**
|
||||
* True if the application is in the process of shutting down.
|
||||
* This is functionally equivalent to the C++ call
|
||||
* AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed);
|
||||
* (which is the preferred way of checking for shutdown in C++).
|
||||
*/
|
||||
[infallible] readonly attribute boolean shuttingDown;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "js/TracingAPI.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/Components.h"
|
||||
@ -32,7 +33,6 @@
|
||||
#include "nsAppRunner.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsChromeRegistry.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIDOMWindowUtils.h" // for nsIJSRAIIHelper
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIIOService.h"
|
||||
@ -756,8 +756,7 @@ RegistryEntries::Destruct() {
|
||||
|
||||
// No point in doing I/O to check for new chrome during shutdown, return
|
||||
// early in that case.
|
||||
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
|
||||
if (!appStartup || appStartup->GetShuttingDown()) {
|
||||
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -5480,7 +5480,8 @@ nsresult XREMain::XRE_mainRun() {
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
CrashReporter::Annotation::useragent_locale, userAgentLocale);
|
||||
|
||||
appStartup->GetShuttingDown(&mShuttingDown);
|
||||
mShuttingDown =
|
||||
AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed);
|
||||
|
||||
if (!mShuttingDown) {
|
||||
/* Special-case services that need early access to the command
|
||||
@ -5615,14 +5616,16 @@ nsresult XREMain::XRE_mainRun() {
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
CrashReporter::Annotation::StartupCrash, false);
|
||||
|
||||
appStartup->GetShuttingDown(&mShuttingDown);
|
||||
mShuttingDown =
|
||||
AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed);
|
||||
}
|
||||
|
||||
if (!mShuttingDown) {
|
||||
rv = cmdLine->Run();
|
||||
NS_ENSURE_SUCCESS_LOG(rv, NS_ERROR_FAILURE);
|
||||
|
||||
appStartup->GetShuttingDown(&mShuttingDown);
|
||||
mShuttingDown =
|
||||
AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed);
|
||||
}
|
||||
|
||||
if (!mShuttingDown) {
|
||||
|
Loading…
Reference in New Issue
Block a user