Update process count preference to a fixed value and enhance content parent selection logic

This commit is contained in:
ownedbywuigi 2026-03-30 11:43:16 +01:00
commit 9a60e2c532
2 changed files with 16 additions and 5 deletions

View file

@ -923,10 +923,8 @@ pref("browser.tabs.remote.force-disable", false);
pref("browser.tabs.remote.desktopbehavior", true); pref("browser.tabs.remote.desktopbehavior", true);
pref("browser.tabs.remote.ignoreBlockPolicy", true); pref("browser.tabs.remote.ignoreBlockPolicy", true);
// Number of web content processes used by e10s. // Number of web content processes used by e10s.
// -1 means automatic tab-isolation mode: try one process per tab. // Keep this at a fixed value in this tree; automatic -1 mode is not supported.
pref("dom.ipc.processCount", -1); pref("dom.ipc.processCount", 4);
// Safety ceiling used by automatic tab-isolation mode.
pref("dom.ipc.processCount.webIsolatedMax", 64);
// This pref governs whether we attempt to work around problems caused by // This pref governs whether we attempt to work around problems caused by
// plugins using OS calls to manipulate the cursor while running out-of- // plugins using OS calls to manipulate the cursor while running out-of-

View file

@ -602,14 +602,27 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
static_cast<uint32_t>(maxContentParents)); static_cast<uint32_t>(maxContentParents));
uint32_t startIdx = rand() % maxSelectable; uint32_t startIdx = rand() % maxSelectable;
uint32_t currIdx = startIdx; uint32_t currIdx = startIdx;
RefPtr<ContentParent> fallback;
do { do {
RefPtr<ContentParent> p = (*contentParents)[currIdx]; RefPtr<ContentParent> p = (*contentParents)[currIdx];
NS_ASSERTION(p->IsAlive(), "Non-alive contentparent in sBrowserContntParents?"); if (!p->IsAlive()) {
currIdx = (currIdx + 1) % maxSelectable;
continue;
}
if (!fallback) {
fallback = p;
}
if (p->mOpener == aOpener) { if (p->mOpener == aOpener) {
return p.forget(); return p.forget();
} }
currIdx = (currIdx + 1) % maxSelectable; currIdx = (currIdx + 1) % maxSelectable;
} while (currIdx != startIdx); } while (currIdx != startIdx);
if (fallback) {
return fallback.forget();
}
} }
RefPtr<ContentParent> p = new ContentParent(aOpener, aForBrowserElement); RefPtr<ContentParent> p = new ContentParent(aOpener, aForBrowserElement);