Bug 1431272 - Set the process priority for the preallocated process when it becomes active. r=jimm
This is currently a no-op, but the idea here is to make sure to set the
process to "active" when we're about to use it for something.
MozReview-Commit-ID: 2QUlALhfD4k
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2750,16 +2750,20 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP
ContentParent::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
if (mSubprocess && (!strcmp(aTopic, "profile-before-change") ||
!strcmp(aTopic, "xpcom-shutdown"))) {
+ // Make sure that our process will get scheduled.
+ ProcessPriorityManager::SetProcessPriority(this,
+ PROCESS_PRIORITY_FOREGROUND);
+
// Okay to call ShutDownProcess multiple times.
ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
// Wait for shutdown to complete, so that we receive any shutdown
// data (e.g. telemetry) from the child before we quit.
// This loop terminate prematurely based on mForceKillTimer.
SpinEventLoopUntil([&]() { return !mIPCOpen || mCalledKillHard; });
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
--- a/dom/ipc/PreallocatedProcessManager.cpp
+++ b/dom/ipc/PreallocatedProcessManager.cpp
@@ -163,16 +163,18 @@ already_AddRefed<ContentParent>
PreallocatedProcessManagerImpl::Take()
{
if (!mEnabled || mShutdown) {
return nullptr;
}
if (mPreallocatedProcess) {
// The preallocated process is taken. Let's try to start up a new one soon.
+ ProcessPriorityManager::SetProcessPriority(mPreallocatedProcess,
+ PROCESS_PRIORITY_FOREGROUND);
AllocateOnIdle();
}
return mPreallocatedProcess.forget();
}
bool
PreallocatedProcessManagerImpl::Provide(ContentParent* aParent)