mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1702530 - do not launch RDD process if XPCOM has started shutdown. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D110982
This commit is contained in:
parent
4b3f251745
commit
b63b46f586
@ -28,6 +28,13 @@ using namespace layers;
|
||||
|
||||
static StaticAutoPtr<RDDProcessManager> sRDDSingleton;
|
||||
|
||||
static bool sXPCOMShutdown = false;
|
||||
|
||||
bool RDDProcessManager::IsShutdown() const {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return sXPCOMShutdown || !sRDDSingleton;
|
||||
}
|
||||
|
||||
RDDProcessManager* RDDProcessManager::Get() { return sRDDSingleton; }
|
||||
|
||||
void RDDProcessManager::Initialize() {
|
||||
@ -71,6 +78,8 @@ RDDProcessManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
}
|
||||
|
||||
void RDDProcessManager::OnXPCOMShutdown() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
sXPCOMShutdown = true;
|
||||
nsContentUtils::UnregisterShutdownObserver(mObserver);
|
||||
Preferences::RemoveObserver(mObserver, "");
|
||||
CleanShutdown();
|
||||
@ -103,8 +112,7 @@ void RDDProcessManager::OnPreferenceChange(const char16_t* aData) {
|
||||
RefPtr<GenericNonExclusivePromise> RDDProcessManager::LaunchRDDProcess() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!Get()) {
|
||||
// Shutdown?
|
||||
if (IsShutdown()) {
|
||||
return GenericNonExclusivePromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
|
||||
__func__);
|
||||
}
|
||||
@ -137,8 +145,7 @@ RefPtr<GenericNonExclusivePromise> RDDProcessManager::LaunchRDDProcess() {
|
||||
mLaunchRDDPromise = mProcess->LaunchPromise()->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[this](bool) {
|
||||
if (!Get()) {
|
||||
// Shutdown?
|
||||
if (IsShutdown()) {
|
||||
return GenericNonExclusivePromise::CreateAndReject(
|
||||
NS_ERROR_NOT_AVAILABLE, __func__);
|
||||
}
|
||||
@ -188,8 +195,7 @@ auto RDDProcessManager::EnsureRDDProcessAndCreateBridge(
|
||||
return LaunchRDDProcess()->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[aOtherProcess, this]() {
|
||||
if (!Get()) {
|
||||
// Shutdown?
|
||||
if (IsShutdown()) {
|
||||
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
|
||||
__func__);
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ class RDDProcessManager final : public RDDProcessHost::Listener {
|
||||
void CleanShutdown();
|
||||
void DestroyProcess();
|
||||
|
||||
bool IsShutdown() const;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RDDProcessManager);
|
||||
|
||||
class Observer final : public nsIObserver {
|
||||
|
Loading…
Reference in New Issue
Block a user