Commit 37acc253 authored by jamescook's avatar jamescook Committed by Commit bot

Remove unused copies of EarlyZygoteLaunch()

It looks like this function got cargo-culted around during refactors.

* Remove unused copies for NaCl, utility process and PPAPI
* Inline the one used copy from RenderProcessHostImpl into BrowserMainLoop

No behavior changes.

BUG=none
TEST=bots

Review-Url: https://codereview.chromium.org/2848603003
Cr-Commit-Position: refs/heads/master@{#468015}
parent d6d85694
...@@ -159,10 +159,6 @@ bool RunningOnWOW64() { ...@@ -159,10 +159,6 @@ bool RunningOnWOW64() {
namespace { namespace {
#if defined(OS_POSIX) && !defined(OS_MACOSX)
content::ZygoteHandle g_nacl_zygote;
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
// NOTE: changes to this class need to be reviewed by the security team. // NOTE: changes to this class need to be reviewed by the security team.
class NaClSandboxedProcessLauncherDelegate class NaClSandboxedProcessLauncherDelegate
: public content::SandboxedProcessLauncherDelegate { : public content::SandboxedProcessLauncherDelegate {
...@@ -333,14 +329,6 @@ void NaClProcessHost::EarlyStartup() { ...@@ -333,14 +329,6 @@ void NaClProcessHost::EarlyStartup() {
NaClBrowser::GetDelegate()->SetDebugPatterns(nacl_debug_mask); NaClBrowser::GetDelegate()->SetDebugPatterns(nacl_debug_mask);
} }
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// static
void NaClProcessHost::EarlyZygoteLaunch() {
DCHECK(!g_nacl_zygote);
g_nacl_zygote = content::CreateZygote();
}
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
void NaClProcessHost::Launch( void NaClProcessHost::Launch(
NaClHostMessageFilter* nacl_host_message_filter, NaClHostMessageFilter* nacl_host_message_filter,
IPC::Message* reply_msg, IPC::Message* reply_msg,
......
...@@ -93,11 +93,6 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { ...@@ -93,11 +93,6 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
// Do any minimal work that must be done at browser startup. // Do any minimal work that must be done at browser startup.
static void EarlyStartup(); static void EarlyStartup();
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Launch the NaCl zygote early in the browser startup.
static void EarlyZygoteLaunch();
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
// Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs.
static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds); static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds);
......
...@@ -177,6 +177,7 @@ ...@@ -177,6 +177,7 @@
#include "content/browser/zygote_host/zygote_host_impl_linux.h" #include "content/browser/zygote_host/zygote_host_impl_linux.h"
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
#include "content/browser/zygote_host/zygote_communication_linux.h"
#include "content/public/browser/zygote_handle_linux.h" #include "content/public/browser/zygote_handle_linux.h"
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
#endif // defined(OS_POSIX) && !defined(OS_MACOSX) #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
...@@ -229,7 +230,11 @@ void SetupSandbox(const base::CommandLine& parsed_command_line) { ...@@ -229,7 +230,11 @@ void SetupSandbox(const base::CommandLine& parsed_command_line) {
// Tickle the zygote host so it forks now. // Tickle the zygote host so it forks now.
ZygoteHostImpl::GetInstance()->Init(parsed_command_line); ZygoteHostImpl::GetInstance()->Init(parsed_command_line);
*GetGenericZygote() = CreateZygote(); *GetGenericZygote() = CreateZygote();
RenderProcessHostImpl::EarlyZygoteLaunch(); // TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a
// proxy. It is currently done this way due to concerns about race
// conditions.
ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus(
(*GetGenericZygote())->GetSandboxStatus());
} }
#endif #endif
......
...@@ -54,10 +54,6 @@ ...@@ -54,10 +54,6 @@
namespace content { namespace content {
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
ZygoteHandle g_ppapi_zygote;
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// NOTE: changes to this class need to be reviewed by the security team. // NOTE: changes to this class need to be reviewed by the security team.
class PpapiPluginSandboxedProcessLauncherDelegate class PpapiPluginSandboxedProcessLauncherDelegate
: public content::SandboxedProcessLauncherDelegate { : public content::SandboxedProcessLauncherDelegate {
...@@ -204,14 +200,6 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( ...@@ -204,14 +200,6 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
return NULL; return NULL;
} }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// static
void PpapiPluginProcessHost::EarlyZygoteLaunch() {
DCHECK(!g_ppapi_zygote);
g_ppapi_zygote = CreateZygote();
}
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// static // static
void PpapiPluginProcessHost::DidCreateOutOfProcessInstance( void PpapiPluginProcessHost::DidCreateOutOfProcessInstance(
int plugin_process_id, int plugin_process_id,
......
...@@ -119,11 +119,6 @@ class PpapiPluginProcessHost : public BrowserChildProcessHostDelegate, ...@@ -119,11 +119,6 @@ class PpapiPluginProcessHost : public BrowserChildProcessHostDelegate,
return profile_data_directory_; return profile_data_directory_;
} }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// Launch the zygote early in the browser startup.
static void EarlyZygoteLaunch();
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// The client pointer must remain valid until its callback is issued. // The client pointer must remain valid until its callback is issued.
private: private:
......
...@@ -224,8 +224,6 @@ ...@@ -224,8 +224,6 @@
#endif #endif
#if defined(OS_POSIX) #if defined(OS_POSIX)
#include "content/browser/zygote_host/zygote_communication_linux.h"
#include "content/browser/zygote_host/zygote_host_impl_linux.h"
#include "content/public/browser/zygote_handle_linux.h" #include "content/public/browser/zygote_handle_linux.h"
#endif // defined(OS_POSIX) #endif // defined(OS_POSIX)
...@@ -383,12 +381,6 @@ SiteProcessMap* GetSiteProcessMapForBrowserContext(BrowserContext* context) { ...@@ -383,12 +381,6 @@ SiteProcessMap* GetSiteProcessMapForBrowserContext(BrowserContext* context) {
return map; return map;
} }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// This static member variable holds the zygote communication information for
// the renderer.
ZygoteHandle g_render_zygote;
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// NOTE: changes to this class need to be reviewed by the security team. // NOTE: changes to this class need to be reviewed by the security team.
class RendererSandboxedProcessLauncherDelegate class RendererSandboxedProcessLauncherDelegate
: public SandboxedProcessLauncherDelegate { : public SandboxedProcessLauncherDelegate {
...@@ -695,18 +687,6 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { ...@@ -695,18 +687,6 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) {
g_max_renderer_count_override = count; g_max_renderer_count_override = count;
} }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// static
void RenderProcessHostImpl::EarlyZygoteLaunch() {
DCHECK(!g_render_zygote);
// TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a
// proxy. It is currently done this way due to concerns about race
// conditions.
ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus(
(*GetGenericZygote())->GetSandboxStatus());
}
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
RenderProcessHostImpl::RenderProcessHostImpl( RenderProcessHostImpl::RenderProcessHostImpl(
BrowserContext* browser_context, BrowserContext* browser_context,
StoragePartitionImpl* storage_partition_impl, StoragePartitionImpl* storage_partition_impl,
......
...@@ -54,12 +54,6 @@ ...@@ -54,12 +54,6 @@
namespace content { namespace content {
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
namespace {
ZygoteHandle g_utility_zygote;
} // namespace
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// NOTE: changes to this class need to be reviewed by the security team. // NOTE: changes to this class need to be reviewed by the security team.
class UtilitySandboxedProcessLauncherDelegate class UtilitySandboxedProcessLauncherDelegate
: public SandboxedProcessLauncherDelegate { : public SandboxedProcessLauncherDelegate {
...@@ -237,14 +231,6 @@ void UtilityProcessHostImpl::SetName(const base::string16& name) { ...@@ -237,14 +231,6 @@ void UtilityProcessHostImpl::SetName(const base::string16& name) {
name_ = name; name_ = name;
} }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// static
void UtilityProcessHostImpl::EarlyZygoteLaunch() {
DCHECK(!g_utility_zygote);
g_utility_zygote = CreateZygote();
}
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
bool UtilityProcessHostImpl::StartProcess() { bool UtilityProcessHostImpl::StartProcess() {
if (started_) if (started_)
return true; return true;
......
...@@ -63,11 +63,6 @@ class CONTENT_EXPORT UtilityProcessHostImpl ...@@ -63,11 +63,6 @@ class CONTENT_EXPORT UtilityProcessHostImpl
void set_child_flags(int flags) { child_flags_ = flags; } void set_child_flags(int flags) { child_flags_ = flags; }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
// Launch the zygote early in the browser startup.
static void EarlyZygoteLaunch();
#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
private: private:
// Starts a process if necessary. Returns true if it succeeded or a process // Starts a process if necessary. Returns true if it succeeded or a process
// has already been started via StartBatchMode(). // has already been started via StartBatchMode().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment