зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1797688 - Part 2: Bail out from gfxFontInfoLoader::StartLoader InOrBeyond(AppShutdown). r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D160620
This commit is contained in:
Родитель
f466a8ebee
Коммит
a93fafd19b
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include "gfxFontInfoLoader.h"
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsXPCOM.h" // for gXPCOMThreadsShutDown
|
||||
#include "nsThreadUtils.h" // for nsRunnable
|
||||
#include "gfxPlatformFontList.h"
|
||||
|
||||
|
@ -113,8 +113,6 @@ nsresult AsyncFontInfoLoader::Run() {
|
|||
|
||||
NS_IMPL_ISUPPORTS(gfxFontInfoLoader::ShutdownObserver, nsIObserver)
|
||||
|
||||
static bool sFontLoaderShutdownObserved = false;
|
||||
|
||||
NS_IMETHODIMP
|
||||
gfxFontInfoLoader::ShutdownObserver::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
|
@ -122,7 +120,6 @@ gfxFontInfoLoader::ShutdownObserver::Observe(nsISupports* aSubject,
|
|||
if (!nsCRT::strcmp(aTopic, "quit-application") ||
|
||||
!nsCRT::strcmp(aTopic, "xpcom-shutdown")) {
|
||||
mLoader->CancelLoader();
|
||||
sFontLoaderShutdownObserved = true;
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected notification topic");
|
||||
}
|
||||
|
@ -143,6 +140,12 @@ void gfxFontInfoLoader::StartLoader(uint32_t aDelay) {
|
|||
return;
|
||||
}
|
||||
|
||||
// We observe for "quit-application" above, so avoid initialization after it.
|
||||
if (NS_WARN_IF(AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdown))) {
|
||||
MOZ_ASSERT(!aDelay, "Delayed gfxFontInfoLoader startup after AppShutdown?");
|
||||
return;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
if (mState != stateInitial && mState != stateTimerOff &&
|
||||
mState != stateTimerOnDelay) {
|
||||
|
@ -165,12 +168,6 @@ void gfxFontInfoLoader::StartLoader(uint32_t aDelay) {
|
|||
|
||||
// Caller asked for a delay? ==> start async thread after a delay
|
||||
if (aDelay) {
|
||||
NS_ASSERTION(!sFontLoaderShutdownObserved,
|
||||
"Bug 1508626 - Setting delay timer for font loader after "
|
||||
"shutdown observed");
|
||||
NS_ASSERTION(!gXPCOMThreadsShutDown,
|
||||
"Bug 1508626 - Setting delay timer for font loader after "
|
||||
"shutdown but before observer");
|
||||
// Set up delay timer, or if there is already a timer in place, just
|
||||
// leave it to do its thing. (This can happen if a StartLoader runnable
|
||||
// was posted to the main thread from the InitFontList thread, but then
|
||||
|
@ -198,13 +195,6 @@ void gfxFontInfoLoader::StartLoader(uint32_t aDelay) {
|
|||
mTimer = nullptr;
|
||||
}
|
||||
|
||||
NS_ASSERTION(
|
||||
!sFontLoaderShutdownObserved,
|
||||
"Bug 1508626 - Initializing font loader after shutdown observed");
|
||||
NS_ASSERTION(!gXPCOMThreadsShutDown,
|
||||
"Bug 1508626 - Initializing font loader after shutdown but "
|
||||
"before observer");
|
||||
|
||||
// initialize
|
||||
InitLoader();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче