forked from mirrors/gecko-dev
Backed out changeset 6aa6da68d232 (bug 1897636) for causing Xpcshell crashes at docshell/test/unit/test_privacy_transition.js.
This commit is contained in:
parent
67039cecb0
commit
05ae0bc4db
2 changed files with 14 additions and 16 deletions
|
|
@ -96,6 +96,7 @@ StaticRefPtr<ShutdownObserver> sObserver;
|
|||
|
||||
/* static */
|
||||
void RemoteDecoderManagerChild::Init() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
LOG("RemoteDecoderManagerChild Init");
|
||||
|
||||
auto remoteDecoderManagerThread = sRemoteDecoderManagerChildThread.Lock();
|
||||
|
|
|
|||
|
|
@ -192,9 +192,8 @@ StaticMutex PDMInitializer::sMonitor;
|
|||
/* static */
|
||||
void PDMInitializer::InitPDMs() {
|
||||
StaticMutexAutoLock mon(sMonitor);
|
||||
if (sHasInitializedPDMs) {
|
||||
return;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!sHasInitializedPDMs);
|
||||
if (XRE_IsGPUProcess()) {
|
||||
PDM_INIT_LOG("Init PDMs in GPU process");
|
||||
InitGpuPDMs();
|
||||
|
|
@ -307,28 +306,26 @@ void PDMFactory::EnsureInit() {
|
|||
if (PDMInitializer::HasInitializedPDMs()) {
|
||||
return;
|
||||
}
|
||||
static Atomic<bool> sInitGfxVarsAndPreferences(false);
|
||||
auto initalizationGfxVarsAndPreferences = []() {
|
||||
auto initalization = []() {
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread());
|
||||
if (!sInitGfxVarsAndPreferences) {
|
||||
if (!PDMInitializer::HasInitializedPDMs()) {
|
||||
// Ensure that all system variables are initialized.
|
||||
gfx::gfxVars::Initialize();
|
||||
// Prime the preferences system from the main thread.
|
||||
Unused << BrowserTabsRemoteAutostart();
|
||||
sInitGfxVarsAndPreferences = true;
|
||||
PDMInitializer::InitPDMs();
|
||||
}
|
||||
};
|
||||
// There are some initialization needed to be done on the main thread.
|
||||
// If on the main thread, then initialize PDMs. Otherwise, do a sync-dispatch
|
||||
// to main thread.
|
||||
if (NS_IsMainThread()) {
|
||||
initalizationGfxVarsAndPreferences();
|
||||
} else {
|
||||
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableFunction("PDMFactory::EnsureInit",
|
||||
std::move(initalizationGfxVarsAndPreferences));
|
||||
SyncRunnable::DispatchToThread(mainTarget, runnable);
|
||||
initalization();
|
||||
return;
|
||||
}
|
||||
PDMInitializer::InitPDMs();
|
||||
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
|
||||
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
|
||||
"PDMFactory::EnsureInit", std::move(initalization));
|
||||
SyncRunnable::DispatchToThread(mainTarget, runnable);
|
||||
}
|
||||
|
||||
RefPtr<PlatformDecoderModule::CreateDecoderPromise> PDMFactory::CreateDecoder(
|
||||
|
|
|
|||
Loading…
Reference in a new issue