Bug 1554785 - Part 1: Support dynamic remote types for GetMaxProcessCount, r=farre

This allows the # of processes to be specified for remote types like
"webIsolated", used by fission windows.

Differential Revision: https://phabricator.services.mozilla.com/D32762

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-06-03 20:04:00 +00:00
parent 7065ccef8c
commit 703600bfc8
2 changed files with 15 additions and 2 deletions

View File

@ -703,12 +703,22 @@ uint32_t ContentParent::GetPoolSize(const nsAString& aContentProcessType) {
/*static*/
uint32_t ContentParent::GetMaxProcessCount(
const nsAString& aContentProcessType) {
if (aContentProcessType.EqualsLiteral("web")) {
// The suffix after a `=` in a remoteType is dynamic, and used to control the
// process pool to use. Max process count is based only on the prefix.
int32_t equalIdx = aContentProcessType.FindChar(L'=');
if (equalIdx == kNotFound) {
equalIdx = aContentProcessType.Length();
}
const nsDependentSubstring processTypePrefix =
StringHead(aContentProcessType, equalIdx);
// Check for the default remote type of "web", as it uses different prefs.
if (processTypePrefix.EqualsLiteral("web")) {
return GetMaxWebProcessCount();
}
nsAutoCString processCountPref("dom.ipc.processCount.");
processCountPref.Append(NS_ConvertUTF16toUTF8(aContentProcessType));
AppendUTF16toUTF8(processTypePrefix, processCountPref);
int32_t maxContentParents;
if (NS_FAILED(

View File

@ -3309,6 +3309,9 @@ pref("dom.ipc.processCount.privilegedabout", 1);
// to avoid multiple of these content processes
pref("dom.ipc.processCount.privilegedmozilla", 1);
// Isolated content processes are always one-per-origin.
pref("dom.ipc.processCount.webIsolated", 1);
// Keep a single privileged about process alive for performance reasons.
// e.g. we do not want to throw content processes out every time we navigate
// away from about:newtab.