Bug 838616 - Boost preallocated process's priority sooner after we decide to transform it into an app process. r=cjones

--HG--
extra : rebase_source : 011d56c6e06bda680d073ae420b84d42e8a37257
This commit is contained in:
Justin Lebar 2013-02-08 14:32:23 +00:00
parent 839fec2a80
commit b6ea2ca2fe

View File

@ -540,6 +540,16 @@ ContentParent::TransformPreallocatedIntoApp(const nsAString& aAppManifestURL,
// Clients should think of mAppManifestURL as const ... we're
// bending the rules here just for the preallocation hack.
const_cast<nsString&>(mAppManifestURL) = aAppManifestURL;
// Boost this process's priority. The subprocess will call
// TemporarilySetProcessPriorityToForeground() from within
// ContentChild::AllocPBrowser, but this happens earlier, thus reducing the
// window in which the child might be killed due to low memory.
if (Preferences::GetBool("dom.ipc.processPriorityManager.enabled")) {
SetProcessPriority(base::GetProcId(mSubprocess->GetChildProcessHandle()),
PROCESS_PRIORITY_FOREGROUND);
}
// If this fails, the child process died.
unused << SendSetProcessPrivileges(aPrivs);
}