Skip to content

Commit

Permalink
Revert "Move zygote code to service_manager"
Browse files Browse the repository at this point in the history
This reverts commit dbe3973.

Reason for revert: Broke compile on LKGR and local builds.
See https://crbug.com/838498.

Original change's description:
> Move zygote code to service_manager
> 
> This CL moves the zygote code from content/ to
> services/service_manager/zygote. This involves moving some switches from
> content_switches.h to services/service_manager/embedder/switches.h and
> moving some codes from content/public/common/result_codes.h to the new
> services/service_manager/embedder/result_codes.h.
> 
> Bug: 831846
> Change-Id: I9776a30412ea43c2c7f511967d2b7d05f18aa841
> Reviewed-on: https://chromium-review.googlesource.com/1012194
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Scott Graham <scottmg@chromium.org>
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Reviewed-by: Stephen Lanham <slan@chromium.org>
> Reviewed-by: Eric Seckler <eseckler@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Jay Civelli <jcivelli@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#554902}

TBR=avi@chromium.org,sky@chromium.org,dschuff@chromium.org,jcivelli@chromium.org,rockot@chromium.org,slan@chromium.org,scottmg@chromium.org,rsesek@chromium.org,eseckler@chromium.org

Change-Id: I318b3d8d74520b1fa7eda3d6d612d54e9dc2f040
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 831846, 838498
Reviewed-on: https://chromium-review.googlesource.com/1036706
Commit-Queue: Matt Giuca <mgiuca@chromium.org>
Reviewed-by: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555001}
  • Loading branch information
mgiuca authored and Commit Bot committed May 1, 2018
1 parent 82fd023 commit 35f7133
Show file tree
Hide file tree
Showing 143 changed files with 577 additions and 758 deletions.
4 changes: 2 additions & 2 deletions android_webview/browser/aw_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int AwBrowserMainParts::PreEarlyInitialization() {
DCHECK(!main_message_loop_.get());
main_message_loop_.reset(new base::MessageLoopForUI);
base::MessageLoopCurrentForUI::Get()->Start();
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}

int AwBrowserMainParts::PreCreateThreads() {
Expand Down Expand Up @@ -130,7 +130,7 @@ int AwBrowserMainParts::PreCreateThreads() {
aw_field_trial_creator_.SetUpFieldTrials();
}

return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}

void AwBrowserMainParts::PreMainMessageLoopRun() {
Expand Down
1 change: 0 additions & 1 deletion apps/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include_rules = [
# app_shell may depend on apps, but not vice versa.
"-extensions/shell",
"+net/base",
"+services/service_manager",
]

specific_include_rules = {
Expand Down
3 changes: 0 additions & 3 deletions chrome/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ include_rules = [
"-webkit",
"-tools",

# Required for process launching.
"+services/service_manager",

# Allow inclusion of WebKit API files.
"+third_party/blink/public/common",
"+third_party/blink/public/platform",
Expand Down
1 change: 1 addition & 0 deletions chrome/android/java/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ include_rules = [

"+device/gamepad/android/java",
"+device/geolocation/android/java",
"+services/service_manager/public/java",
]

specific_include_rules = {
Expand Down
2 changes: 2 additions & 0 deletions chrome/android/javatests/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ include_rules = [

"+device/geolocation/android/java",
"+device/geolocation/android/javatests",

"+services/service_manager/public/java",
]

specific_include_rules = {
Expand Down
1 change: 1 addition & 0 deletions chrome/app/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ include_rules = [
"+native_client/src/trusted/service_runtime/osx",
"+remoting/client/plugin",
"+sandbox",
"+services/service_manager",
"+services/ui/public",
"+third_party/breakpad/breakpad",
"+third_party/crashpad/crashpad",
Expand Down
3 changes: 1 addition & 2 deletions chrome/app/chrome_crash_reporter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "chrome/installer/util/google_update_settings.h"
#include "components/crash/core/common/crash_keys.h"
#include "content/public/common/content_switches.h"
#include "services/service_manager/embedder/switches.h"

#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "components/upload_list/crash_upload_list.h"
Expand Down Expand Up @@ -134,7 +133,7 @@ bool ChromeCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) {
return process_type == switches::kRendererProcess ||
process_type == switches::kPpapiPluginProcess ||
process_type == service_manager::switches::kZygoteProcess ||
process_type == switches::kZygoteProcess ||
process_type == switches::kGpuProcess ||
process_type == switches::kUtilityProcess;
}
13 changes: 6 additions & 7 deletions chrome/app/chrome_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void AdjustLinuxOOMScore(const std::string& process_type) {
process_type == switches::kNaClLoaderNonSfiProcess) {
score = kPluginScore;
#endif
} else if (process_type == service_manager::switches::kZygoteProcess ||
} else if (process_type == switches::kZygoteProcess ||
process_type ==
service_manager::switches::kProcessTypeServiceManager ||
process_type.empty()) {
Expand Down Expand Up @@ -303,7 +303,7 @@ bool SubprocessNeedsResourceBundle(const std::string& process_type) {
return
#if defined(OS_LINUX)
// The zygote process opens the resources for the renderers.
process_type == service_manager::switches::kZygoteProcess ||
process_type == switches::kZygoteProcess ||
#endif
#if defined(OS_MACOSX)
// Mac needs them too for scrollbar related images and for sandbox
Expand Down Expand Up @@ -820,13 +820,13 @@ void ChromeMainDelegate::PreSandboxStartup() {
// browser process as a command line flag.
#if !BUILDFLAG(ENABLE_NACL)
DCHECK(command_line.HasSwitch(switches::kLang) ||
process_type == service_manager::switches::kZygoteProcess ||
process_type == switches::kZygoteProcess ||
process_type == switches::kGpuProcess ||
process_type == switches::kPpapiBrokerProcess ||
process_type == switches::kPpapiPluginProcess);
#else
DCHECK(command_line.HasSwitch(switches::kLang) ||
process_type == service_manager::switches::kZygoteProcess ||
process_type == switches::kZygoteProcess ||
process_type == switches::kGpuProcess ||
process_type == switches::kNaClLoaderProcess ||
process_type == switches::kPpapiBrokerProcess ||
Expand Down Expand Up @@ -895,7 +895,7 @@ void ChromeMainDelegate::PreSandboxStartup() {

#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Zygote needs to call InitCrashReporter() in RunZygote().
if (process_type != service_manager::switches::kZygoteProcess) {
if (process_type != switches::kZygoteProcess) {
#if defined(OS_ANDROID)
if (process_type.empty()) {
breakpad::InitCrashReporter(process_type);
Expand Down Expand Up @@ -1018,8 +1018,7 @@ bool ChromeMainDelegate::DelaySandboxInitialization(
}
#elif defined(OS_LINUX)
void ChromeMainDelegate::ZygoteStarting(
std::vector<std::unique_ptr<service_manager::ZygoteForkDelegate>>*
delegates) {
std::vector<std::unique_ptr<content::ZygoteForkDelegate>>* delegates) {
#if defined(OS_CHROMEOS)
chromeos::ReloadElfTextInHugePages();
#endif
Expand Down
5 changes: 2 additions & 3 deletions chrome/app/chrome_main_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ class ChromeMainDelegate : public content::ContentMainDelegate {
bool ShouldSendMachPort(const std::string& process_type) override;
bool DelaySandboxInitialization(const std::string& process_type) override;
#elif defined(OS_LINUX)
void ZygoteStarting(
std::vector<std::unique_ptr<service_manager::ZygoteForkDelegate>>*
delegates) override;
void ZygoteStarting(std::vector<std::unique_ptr<content::ZygoteForkDelegate>>*
delegates) override;
void ZygoteForked() override;
#endif
bool ShouldEnableProfilerRecording() override;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ include_rules = [
"+services/proxy_resolver/public/mojom",
"+services/resource_coordinator/public/cpp",
"+services/resource_coordinator/public/mojom",
"+services/service_manager",
"+services/shape_detection/public/mojom",
"+services/ui/common",
"+services/ui/public",
Expand Down
30 changes: 15 additions & 15 deletions chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ ChromeBrowserMainParts::ChromeBrowserMainParts(
const content::MainFunctionParams& parameters)
: parameters_(parameters),
parsed_command_line_(parameters.command_line),
result_code_(service_manager::RESULT_CODE_NORMAL_EXIT),
result_code_(content::RESULT_CODE_NORMAL_EXIT),
startup_watcher_(new StartupTimeBomb()),
shutdown_watcher_(new ShutdownWatcherHelper()),
ui_thread_profiler_(ThreadProfiler::CreateAndStartOnMainThread()),
Expand Down Expand Up @@ -1075,7 +1075,7 @@ int ChromeBrowserMainParts::PreEarlyInitialization() {
}
// Continue on and show error later (once UI has been initialized and main
// message loop is running).
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}
return load_local_state_result;
}
Expand Down Expand Up @@ -1128,7 +1128,7 @@ int ChromeBrowserMainParts::PreCreateThreads() {
TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreads");
result_code_ = PreCreateThreadsImpl();

if (result_code_ == service_manager::RESULT_CODE_NORMAL_EXIT) {
if (result_code_ == content::RESULT_CODE_NORMAL_EXIT) {
#if !defined(OS_ANDROID)
// These members must be initialized before exiting this function normally.
DCHECK(master_prefs_.get());
Expand Down Expand Up @@ -1171,7 +1171,7 @@ int ChromeBrowserMainParts::LoadLocalState(
}

const int apply_first_run_result = ApplyFirstRunPrefs();
if (apply_first_run_result != service_manager::RESULT_CODE_NORMAL_EXIT)
if (apply_first_run_result != content::RESULT_CODE_NORMAL_EXIT)
return apply_first_run_result;

browser_process_->SetApplicationLocale(locale);
Expand All @@ -1186,7 +1186,7 @@ int ChromeBrowserMainParts::LoadLocalState(
// tasks.
SetupFieldTrials();

return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}

int ChromeBrowserMainParts::ApplyFirstRunPrefs() {
Expand All @@ -1197,7 +1197,7 @@ int ChromeBrowserMainParts::ApplyFirstRunPrefs() {
// browser's profile_manager object is created, but after ResourceBundle
// is initialized.
if (!first_run::IsChromeFirstRun())
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;

first_run::ProcessMasterPreferencesResult pmp_result =
first_run::ProcessMasterPreferences(user_data_dir_, master_prefs_.get());
Expand Down Expand Up @@ -1239,7 +1239,7 @@ int ChromeBrowserMainParts::ApplyFirstRunPrefs() {
local_state->SetBoolean(prefs::kWelcomePageOnOSUpgradeEnabled, false);
#endif
#endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}

int ChromeBrowserMainParts::PreCreateThreadsImpl() {
Expand Down Expand Up @@ -1418,7 +1418,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
// which is used in SetupMetrics().
SetupMetrics();

return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}

void ChromeBrowserMainParts::PostCreateThreads() {
Expand Down Expand Up @@ -1631,7 +1631,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
}

return shell_integration::SetAsDefaultBrowser()
? static_cast<int>(service_manager::RESULT_CODE_NORMAL_EXIT)
? static_cast<int>(content::RESULT_CODE_NORMAL_EXIT)
: static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED);
}

Expand All @@ -1647,7 +1647,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
if (parsed_command_line().HasSwitch(switches::kPackExtension)) {
extensions::StartupHelper extension_startup_helper;
if (extension_startup_helper.PackExtension(parsed_command_line()))
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
return chrome::RESULT_CODE_PACK_EXTENSION_ERROR;
}

Expand Down Expand Up @@ -1678,7 +1678,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// expected.
if (parsed_command_line().HasSwitch(switches::kTestType))
return chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED;
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;

case ProcessSingleton::PROFILE_IN_USE:
return chrome::RESULT_CODE_PROFILE_IN_USE;
Expand Down Expand Up @@ -1738,15 +1738,15 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
}
#else
// We don't support retention experiments on Mac or Linux.
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
#endif // defined(OS_WIN)
}
#endif // !defined(OS_ANDROID)

#if defined(OS_WIN)
// Do the tasks if chrome has been upgraded while it was last running.
if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line()))
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;

// Check if there is any machine level Chrome installed on the current
// machine. If yes and the current Chrome process is user level, we do not
Expand Down Expand Up @@ -1776,7 +1776,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
user_data_dir_,
parsed_command_line());
if (!profile_)
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;

#if !defined(OS_ANDROID)
const base::TimeTicks start_time_step2 = base::TimeTicks::Now();
Expand Down Expand Up @@ -1830,7 +1830,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// The first run dialog is modal, and spins a RunLoop, which could receive
// a SIGTERM, and call chrome::AttemptExit(). Exit cleanly in that case.
if (browser_shutdown::IsTryingToQuit())
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;

if (!master_prefs_->suppress_first_run_default_browser_prompt) {
browser_creator_->set_show_main_browser_window(
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chrome_browser_main_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ ChromeBrowserMainPartsPosix::ChromeBrowserMainPartsPosix(

int ChromeBrowserMainPartsPosix::PreEarlyInitialization() {
const int result = ChromeBrowserMainParts::PreEarlyInitialization();
if (result != service_manager::RESULT_CODE_NORMAL_EXIT)
if (result != content::RESULT_CODE_NORMAL_EXIT)
return result;

// We need to accept SIGCHLD, even though our handler is a no-op because
Expand All @@ -124,7 +124,7 @@ int ChromeBrowserMainPartsPosix::PreEarlyInitialization() {
action.sa_handler = SIGCHLDHandler;
CHECK(sigaction(SIGCHLD, &action, NULL) == 0);

return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}

void ChromeBrowserMainPartsPosix::PostMainMessageLoopStart() {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chrome_browser_main_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ int ChromeBrowserMainPartsWin::HandleIconsCommands(
ShellExecute(NULL, NULL, L"appwiz.cpl", NULL, NULL, SW_SHOWNORMAL);

// Exit as we are not launching the browser.
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}
// We don't hide icons so we shouldn't do anything special to show them
return chrome::RESULT_CODE_UNSUPPORTED_PARAM;
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@
#include "services/preferences/public/cpp/in_process_service_factory.h"
#include "services/preferences/public/mojom/preferences.mojom.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/embedder/switches.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "services/service_manager/sandbox/sandbox_type.h"
Expand Down Expand Up @@ -2021,7 +2020,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
arraysize(kSwitchNames));
#endif
} else if (process_type == service_manager::switches::kZygoteProcess) {
} else if (process_type == switches::kZygoteProcess) {
static const char* const kSwitchNames[] = {
// Load (in-process) Pepper plugins in-process in the zygote pre-sandbox.
switches::kDisableBundledPpapiFlash,
Expand Down Expand Up @@ -3122,7 +3121,7 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
#else
int crash_signal_fd = GetCrashSignalFD(command_line);
if (crash_signal_fd >= 0) {
mappings->Share(service_manager::kCrashDumpSignal, crash_signal_fd);
mappings->Share(kCrashDumpSignal, crash_signal_fd);
}
#endif // defined(OS_ANDROID)
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/memory_details.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "ui/base/l10n/l10n_util.h"

#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
#include "services/service_manager/zygote/zygote_host_linux.h"
#include "content/public/browser/zygote_host_linux.h"
#endif

#if BUILDFLAG(ENABLE_EXTENSIONS)
Expand Down Expand Up @@ -342,7 +342,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
}

#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
if (service_manager::ZygoteHost::GetInstance()->IsZygotePid(process.pid)) {
if (content::ZygoteHost::GetInstance()->IsZygotePid(process.pid)) {
process.process_type = content::PROCESS_TYPE_ZYGOTE;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host.h"
#include "services/service_manager/zygote/zygote_host_linux.h"
#include "content/public/browser/zygote_host_linux.h"
#include "ui/wm/public/activation_client.h"

using base::ProcessHandle;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/uninstall_browser_prompt.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace chrome {

// Asks user for uninstall confirmation and returns one of these values:
// service_manager::RESULT_CODE_NORMAL_EXIT,
// content::RESULT_CODE_NORMAL_EXIT,
// chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE or
// chrome::RESULT_CODE_UNINSTALL_USER_CANCEL.
int ShowUninstallBrowserPrompt();
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/uninstall_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void UninstallView::SetupControls() {
}

bool UninstallView::Accept() {
user_selection_ = service_manager::RESULT_CODE_NORMAL_EXIT;
user_selection_ = content::RESULT_CODE_NORMAL_EXIT;
if (delete_profile_->checked())
user_selection_ = chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE;
if (change_default_browser_ && change_default_browser_->checked()) {
Expand Down Expand Up @@ -176,7 +176,7 @@ namespace chrome {

int ShowUninstallBrowserPrompt() {
DCHECK(base::MessageLoopForUI::IsCurrent());
int result = service_manager::RESULT_CODE_NORMAL_EXIT;
int result = content::RESULT_CODE_NORMAL_EXIT;

// Register a KeepAlive while showing the dialog. This is done because the
// dialog uses the views framework which may take and release a KeepAlive
Expand Down
Loading

0 comments on commit 35f7133

Please sign in to comment.