diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 511076f79bee..e1efe7cef759 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -631,8 +631,6 @@ ContentParent::PreallocateProcess() eNotRecordingOrReplaying, /* aRecordingFile = */ EmptyString()); - PreallocatedProcessManager::AddBlocker(process); - if (!process->LaunchSubprocess(PROCESS_PRIORITY_PREALLOC)) { return nullptr; } @@ -902,13 +900,13 @@ ContentParent::GetNewOrUsedBrowserProcess(Element* aFrameElement, // Create a new process from scratch. RefPtr p = new ContentParent(aOpener, aRemoteType, recordReplayState, recordingFile); - // Until the new process is ready let's not allow to start up any preallocated processes. - PreallocatedProcessManager::AddBlocker(p); - if (!p->LaunchSubprocess(aPriority)) { return nullptr; } + // Until the new process is ready let's not allow to start up any preallocated processes. + PreallocatedProcessManager::AddBlocker(p); + if (recordReplayState == eNotRecordingOrReplaying) { contentParents.AppendElement(p); } diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index e70d6cf60635..e6a3567ba6ee 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -212,7 +212,13 @@ void PreallocatedProcessManagerImpl::RemoveBlocker(ContentParent* aParent) { uint64_t childID = aParent->ChildID(); - MOZ_ASSERT(mBlockers.Contains(childID)); + // This used to assert that the blocker existed, but preallocated + // processes aren't blockers anymore because it's not useful and + // interferes with async launch, and it's simpler if content + // processes don't need to remember whether they were preallocated. + // (And preallocated processes can't AddBlocker when taken, because + // it's possible for a short-lived process to be recycled through + // Provide() and Take() before reaching RecvFirstIdle.) mBlockers.RemoveEntry(childID); if (!mPreallocatedProcess && mBlockers.IsEmpty()) { AllocateAfterDelay();