Backed out changeset 481e9149f22f (bug 1647470) for bc failures on browser_resource_uri.js.

This commit is contained in:
Cosmin Sabou 2020-06-24 02:44:33 +03:00
Родитель 762d6b5b85
Коммит 76255bd145
2 изменённых файлов: 10 добавлений и 21 удалений

Просмотреть файл

@ -39,16 +39,19 @@ MinTabSelector.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
provideProcess(aType, aOpener, aProcesses, aMaxCount) {
if (aProcesses.length < aMaxCount) {
return Ci.nsIContentProcessProvider.NEW_PROCESS;
}
let min = Number.MAX_VALUE;
let candidate = Ci.nsIContentProcessProvider.NEW_PROCESS;
// The reason for not directly using aProcesses.length here is because if
// we keep processes alive for testing but want a test to use only single
// Note, that at this point aMaxCount is in the valid range and
// the reason for not using aProcesses.length here is because if we keep
// processes alive for testing but want a test to use only single
// content process we can just keep relying on dom.ipc.processCount = 1
// this way.
let numIters = Math.min(aProcesses.length, aMaxCount);
for (let i = 0; i < numIters; i++) {
for (let i = 0; i < aMaxCount; i++) {
let process = aProcesses[i];
let tabCount = process.tabCount;
if (process.opener === aOpener && tabCount < min) {
@ -57,13 +60,6 @@ MinTabSelector.prototype = {
}
}
// If all current processes have at least one tab and we have not yet
// reached the maximum, spawn a new process.
if (min > 0 && aProcesses.length < aMaxCount) {
return Ci.nsIContentProcessProvider.NEW_PROCESS;
}
// Otherwise we use candidate.
return candidate;
},
};

Просмотреть файл

@ -860,14 +860,6 @@ already_AddRefed<ContentParent> ContentParent::MinTabSelect(
}
}
// If all current processes have at least one tab and we have not yet reached
// the maximum, use a new process.
if (min > 0 &&
aContentParents.Length() < static_cast<uint32_t>(aMaxContentParents)) {
return nullptr;
}
// Otherwise we return candidate.
return candidate.forget();
}
@ -924,7 +916,8 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
// selection.
NS_WARNING("nsIContentProcessProvider failed to return a process");
RefPtr<ContentParent> random;
if ((random = MinTabSelect(aContentParents, aOpener, aMaxContentParents))) {
if (aContentParents.Length() >= aMaxContentParents &&
(random = MinTabSelect(aContentParents, aOpener, aMaxContentParents))) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetUsedProcess: Reused random process %p (%d) for %s",
random.get(), (unsigned int)random->ChildID(),