Bug 1551101. Stop using [array] in nsIContentProcess. r=mccr8

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-05-13 15:58:01 +00:00
parent f715b952c4
commit 31102496fd
3 changed files with 10 additions and 11 deletions

View File

@ -11,8 +11,8 @@ RandomSelector.prototype = {
classID: Components.ID("{c616fcfd-9737-41f1-aa74-cee72a38f91b}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
provideProcess(aType, aOpener, aProcesses, aCount, aMaxCount) {
if (aCount < aMaxCount) {
provideProcess(aType, aOpener, aProcesses, aMaxCount) {
if (aProcesses.length < aMaxCount) {
return Ci.nsIContentProcessProvider.NEW_PROCESS;
}
@ -40,8 +40,8 @@ MinTabSelector.prototype = {
classID: Components.ID("{2dc08eaf-6eef-4394-b1df-a3a927c1290b}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsIContentProcessProvider]),
provideProcess(aType, aOpener, aProcesses, aCount, aMaxCount) {
if (aCount < aMaxCount) {
provideProcess(aType, aOpener, aProcesses, aMaxCount) {
if (aProcesses.length < aMaxCount) {
return Ci.nsIContentProcessProvider.NEW_PROCESS;
}
@ -49,7 +49,7 @@ MinTabSelector.prototype = {
let candidate = Ci.nsIContentProcessProvider.NEW_PROCESS;
// Note, that at this point aMaxCount is in the valid range and
// the reason for not using aCount here is because if we keep
// 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.

View File

@ -51,6 +51,6 @@ interface nsIContentProcessProvider : nsISupports
* caller to create a new content process.
*/
int32_t provideProcess(in AString aType, in nsIContentProcessInfo aOpener,
[array, size_is(aCount)] in nsIContentProcessInfo aAliveProcesses,
in uint32_t aCount, in uint32_t aMaxCount);
in Array<nsIContentProcessInfo> aAliveProcesses,
in uint32_t aMaxCount);
};

View File

@ -842,7 +842,7 @@ already_AddRefed<ContentParent> ContentParent::GetNewOrUsedBrowserProcess(
}
} else {
uint32_t numberOfParents = contentParents.Length();
nsTArray<nsIContentProcessInfo*> infos(numberOfParents);
nsTArray<RefPtr<nsIContentProcessInfo>> infos(numberOfParents);
for (auto* cp : contentParents) {
infos.AppendElement(cp->mScriptableHelper);
}
@ -858,9 +858,8 @@ already_AddRefed<ContentParent> ContentParent::GetNewOrUsedBrowserProcess(
nsIContentProcessInfo* openerInfo =
aOpener ? aOpener->mScriptableHelper.get() : nullptr;
int32_t index;
if (cpp && NS_SUCCEEDED(cpp->ProvideProcess(
aRemoteType, openerInfo, infos.Elements(), infos.Length(),
maxContentParents, &index))) {
if (cpp && NS_SUCCEEDED(cpp->ProvideProcess(aRemoteType, openerInfo, infos,
maxContentParents, &index))) {
// If the provider returned an existing ContentParent, use that one.
if (0 <= index && static_cast<uint32_t>(index) <= maxContentParents) {
RefPtr<ContentParent> retval = contentParents[index];