Bug 1652144 - Part 1: Remove unused argument from process launch methods, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D84060
This commit is contained in:
Nika Layzell 2020-07-24 20:24:33 +00:00
Родитель bb8f770917
Коммит 03de005ca0
6 изменённых файлов: 18 добавлений и 43 удалений

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

@ -930,7 +930,6 @@ CanonicalBrowsingContext::ChangeRemoteness(const nsACString& aRemoteType,
change->ProcessReady();
} else {
change->mContentParent = ContentParent::GetNewOrUsedLaunchingBrowserProcess(
/* aFrameElement = */ nullptr,
/* aRemoteType = */ aRemoteType,
/* aPriority = */ hal::PROCESS_PRIORITY_FOREGROUND,
/* aPreferUsed = */ false);

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

@ -979,8 +979,8 @@ already_AddRefed<ContentParent> ContentParent::GetUsedBrowserProcess(
/*static*/
already_AddRefed<ContentParent>
ContentParent::GetNewOrUsedLaunchingBrowserProcess(
Element* aFrameElement, const nsACString& aRemoteType,
ProcessPriority aPriority, bool aPreferUsed) {
const nsACString& aRemoteType, ProcessPriority aPriority,
bool aPreferUsed) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetNewOrUsedProcess for type %s",
PromiseFlatCString(aRemoteType).get()));
@ -991,8 +991,7 @@ ContentParent::GetNewOrUsedLaunchingBrowserProcess(
contentParents.Length() >= maxContentParents) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("GetNewOrUsedProcess: returning Large Used process"));
return GetNewOrUsedLaunchingBrowserProcess(aFrameElement,
DEFAULT_REMOTE_TYPE, aPriority,
return GetNewOrUsedLaunchingBrowserProcess(DEFAULT_REMOTE_TYPE, aPriority,
/*aPreferUsed =*/false);
}
@ -1040,13 +1039,12 @@ ContentParent::GetNewOrUsedLaunchingBrowserProcess(
/*static*/
RefPtr<ContentParent::LaunchPromise>
ContentParent::GetNewOrUsedBrowserProcessAsync(Element* aFrameElement,
const nsACString& aRemoteType,
ContentParent::GetNewOrUsedBrowserProcessAsync(const nsACString& aRemoteType,
ProcessPriority aPriority,
bool aPreferUsed) {
// Obtain a `ContentParent` launched asynchronously.
RefPtr<ContentParent> contentParent = GetNewOrUsedLaunchingBrowserProcess(
aFrameElement, aRemoteType, aPriority, aPreferUsed);
RefPtr<ContentParent> contentParent =
GetNewOrUsedLaunchingBrowserProcess(aRemoteType, aPriority, aPreferUsed);
if (!contentParent) {
// In case of launch error, stop here.
return LaunchPromise::CreateAndReject(LaunchError(), __func__);
@ -1056,10 +1054,10 @@ ContentParent::GetNewOrUsedBrowserProcessAsync(Element* aFrameElement,
/*static*/
already_AddRefed<ContentParent> ContentParent::GetNewOrUsedBrowserProcess(
Element* aFrameElement, const nsACString& aRemoteType,
ProcessPriority aPriority, bool aPreferUsed) {
RefPtr<ContentParent> contentParent = GetNewOrUsedLaunchingBrowserProcess(
aFrameElement, aRemoteType, aPriority, aPreferUsed);
const nsACString& aRemoteType, ProcessPriority aPriority,
bool aPreferUsed) {
RefPtr<ContentParent> contentParent =
GetNewOrUsedLaunchingBrowserProcess(aRemoteType, aPriority, aPreferUsed);
if (!contentParent || !contentParent->WaitForLaunchSync(aPriority)) {
// In case of launch error, stop here.
return nullptr;
@ -1156,24 +1154,6 @@ already_AddRefed<ContentParent> ContentParent::GetNewOrUsedJSPluginProcess(
return p.forget();
}
/*static*/
ProcessPriority ContentParent::GetInitialProcessPriority(
Element* aFrameElement) {
// Frames with mozapptype == critical which are expecting a system message
// get FOREGROUND_HIGH priority.
if (!aFrameElement) {
return PROCESS_PRIORITY_FOREGROUND;
}
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aFrameElement);
if (!browserFrame) {
return PROCESS_PRIORITY_FOREGROUND;
}
return PROCESS_PRIORITY_FOREGROUND;
}
#if defined(XP_WIN)
extern const wchar_t* kPluginWidgetContentParentProperty;
@ -1318,7 +1298,6 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
remoteType = DEFAULT_REMOTE_TYPE;
}
ProcessPriority initialPriority = GetInitialProcessPriority(aFrameElement);
TabId tabId(nsContentUtils::GenerateTabId());
nsIDocShell* docShell = GetOpenerDocShellHelper(aFrameElement);
@ -1341,11 +1320,11 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
constructorSender = aOpenerContentParent;
} else {
if (aContext.IsJSPlugin()) {
constructorSender =
GetNewOrUsedJSPluginProcess(aContext.JSPluginId(), initialPriority);
constructorSender = GetNewOrUsedJSPluginProcess(
aContext.JSPluginId(), PROCESS_PRIORITY_FOREGROUND);
} else {
constructorSender = GetNewOrUsedBrowserProcess(
aFrameElement, remoteType, initialPriority, isPreloadBrowser);
remoteType, PROCESS_PRIORITY_FOREGROUND, isPreloadBrowser);
}
if (!constructorSender) {
return nullptr;

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

@ -188,12 +188,12 @@ class ContentParent final
* 3. normal iframe
*/
static RefPtr<ContentParent::LaunchPromise> GetNewOrUsedBrowserProcessAsync(
Element* aFrameElement, const nsACString& aRemoteType,
const nsACString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
bool aPreferUsed = false);
static already_AddRefed<ContentParent> GetNewOrUsedBrowserProcess(
Element* aFrameElement, const nsACString& aRemoteType,
const nsACString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
bool aPreferUsed = false);
@ -209,7 +209,7 @@ class ContentParent final
* the process to be fully launched.
*/
static already_AddRefed<ContentParent> GetNewOrUsedLaunchingBrowserProcess(
Element* aFrameElement, const nsACString& aRemoteType,
const nsACString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
bool aPreferUsed = false);
@ -642,8 +642,6 @@ class ContentParent final
void OnCompositorDeviceReset() override;
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
// Control the priority of the IPC messages for input events.
void SetInputPriorityEventEnabled(bool aEnabled);
bool IsInputPriorityEventEnabled() { return mIsInputPriorityEventEnabled; }

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

@ -589,7 +589,6 @@ void RemoteWorkerManager::LaunchNewContentProcess(
workerRemoteType.IsEmpty() ? DEFAULT_REMOTE_TYPE : workerRemoteType;
ContentParent::GetNewOrUsedBrowserProcessAsync(
/* aFrameElement = */ nullptr,
/* aRemoteType = */ remoteType)
->Then(GetCurrentSerialEventTarget(), __func__,
[callback = std::move(callback),

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

@ -847,7 +847,7 @@ nsXULAppInfo::EnsureContentProcess() {
if (!XRE_IsParentProcess()) return NS_ERROR_NOT_AVAILABLE;
RefPtr<ContentParent> unused =
ContentParent::GetNewOrUsedBrowserProcess(nullptr, DEFAULT_REMOTE_TYPE);
ContentParent::GetNewOrUsedBrowserProcess(DEFAULT_REMOTE_TYPE);
return NS_OK;
}

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

@ -948,7 +948,7 @@ TestShellParent* GetOrCreateTestShellParent() {
// chrome mochitest where you can have multiple types of content
// processes.
RefPtr<ContentParent> parent =
ContentParent::GetNewOrUsedBrowserProcess(nullptr, DEFAULT_REMOTE_TYPE);
ContentParent::GetNewOrUsedBrowserProcess(DEFAULT_REMOTE_TYPE);
parent.forget(&gContentParent);
} else if (!gContentParent->IsAlive()) {
return nullptr;