Bug 1609881 - Part 1: put the fork server behind a preference. r=gsvelto

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thinker Li 2020-02-12 16:57:39 +00:00
Родитель f604a47fa5
Коммит 47a47a3233
5 изменённых файлов: 18 добавлений и 7 удалений

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

@ -215,7 +215,7 @@ static bool LaunchAppWithForkServer(const std::vector<std::string>& argv,
bool LaunchApp(const std::vector<std::string>& argv,
const LaunchOptions& options, ProcessHandle* process_handle) {
#if defined(MOZ_ENABLE_FORKSERVER)
if (options.use_forkserver) {
if (options.use_forkserver && ForkServiceChild::Get()) {
return LaunchAppWithForkServer(argv, options, process_handle);
}
#endif

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

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -8,6 +8,7 @@
#include "mozilla/ipc/IPDLParamTraits.h"
#include "mozilla/Logging.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/StaticPrefs_dom.h"
#include <unistd.h>
#include <fcntl.h>
@ -124,7 +125,9 @@ already_AddRefed<ForkServerLauncher> ForkServerLauncher::Create() {
NS_IMETHODIMP
ForkServerLauncher::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
if (!mHaveStartedClient && strcmp(aTopic, NS_XPCOM_STARTUP_CATEGORY) == 0) {
if (!mHaveStartedClient &&
strcmp(aTopic, NS_XPCOM_STARTUP_CATEGORY) == 0 &&
StaticPrefs::dom_ipc_forkserver_enable_AtStartup()) {
mHaveStartedClient = true;
ForkServiceChild::StartForkServer();

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

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

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

@ -362,7 +362,8 @@ GeckoChildProcessHost::GeckoChildProcessHost(GeckoProcessType aProcessType,
}
#endif
#if defined(MOZ_ENABLE_FORKSERVER)
if (aProcessType == GeckoProcessType_Content) {
if (aProcessType == GeckoProcessType_Content &&
ForkServiceChild::Get()) {
mLaunchOptions->use_forkserver = true;
}
#endif

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

@ -1676,6 +1676,13 @@
value: 500
mirror: always
#ifdef MOZ_ENABLE_FORKSERVER
- name: dom.ipc.forkserver.enable
type: bool
value: false
mirror: once
#endif
# Whether or not to collect a paired minidump when force-killing a
# content process.
- name: dom.ipc.tabs.createKillHardCrashReports