Commit f8ba13dd authored by jam@chromium.org's avatar jam@chromium.org

Move ZygoteForkDelegateLinux to content/public/common.

BUG=98716
Review URL: http://codereview.chromium.org/8381029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107128 0039d316-1c4b-4281-b951-d872f2087c98
parent 0981f86e
......@@ -72,7 +72,7 @@
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "chrome/common/nacl_fork_delegate_linux.h"
#include "chrome/app/nacl_fork_delegate_linux.h"
#endif
#if defined(OS_CHROMEOS)
......@@ -704,7 +704,7 @@ bool ChromeMainDelegate::DelaySandboxInitialization(
process_type == switches::kRelauncherProcess;
}
#elif defined(OS_POSIX)
ZygoteForkDelegate* ChromeMainDelegate::ZygoteStarting() {
content::ZygoteForkDelegate* ChromeMainDelegate::ZygoteStarting() {
// Each Renderer we spawn will re-attempt initialization of the media
// libraries, at which point failure will be detected and handled, so
// we do not need to cope with initialization failures here.
......
......@@ -38,7 +38,7 @@ class ChromeMainDelegate : public content::ContentMainDelegate {
virtual bool DelaySandboxInitialization(
const std::string& process_type) OVERRIDE;
#elif defined(OS_POSIX)
virtual ZygoteForkDelegate* ZygoteStarting() OVERRIDE;
virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE;
virtual void ZygoteForked() OVERRIDE;
#endif
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/common/nacl_fork_delegate_linux.h"
#include "chrome/app/nacl_fork_delegate_linux.h"
#include <signal.h>
#include <stdlib.h>
......@@ -17,7 +17,6 @@
#include "base/process_util.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "content/common/unix_domain_socket_posix.h"
#include "content/common/zygote_fork_delegate_linux.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/nacl_helper_linux.h"
......
......@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_COMMON_NACL_FORK_DELEGATE_LINUX_H_
#define CHROME_COMMON_NACL_FORK_DELEGATE_LINUX_H_
#ifndef CHROME_APP_NACL_FORK_DELEGATE_LINUX_H_
#define CHROME_APP_NACL_FORK_DELEGATE_LINUX_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "content/common/zygote_fork_delegate_linux.h"
#include "content/public/common/zygote_fork_delegate_linux.h"
// The NaClForkDelegate is created during Chrome linux zygote
// initialization, and provides "fork()" functionality with
// NaCl specific process characteristics (specifically address
// space layout) as an alternative to forking the zygote.
// A new delegate is passed in as an argument to ZygoteMain().
class NaClForkDelegate : public ZygoteForkDelegate {
class NaClForkDelegate : public content::ZygoteForkDelegate {
public:
NaClForkDelegate();
virtual ~NaClForkDelegate();
......@@ -51,4 +51,4 @@ class NaClForkDelegate : public ZygoteForkDelegate {
int fd_;
};
#endif // CHROME_COMMON_NACL_FORK_DELEGATE_LINUX_H_
#endif // CHROME_APP_NACL_FORK_DELEGATE_LINUX_H_
......@@ -46,7 +46,8 @@
'__STDC_LIMIT_MACROS=1',
],
'sources': [
'nacl/nacl_fork_delegate_linux.cc',
'app/nacl_fork_delegate_linux.cc',
'app/nacl_fork_delegate_linux.h',
],
},],
],
......
......@@ -48,7 +48,7 @@
#include "content/common/chrome_descriptors.h"
#if !defined(OS_MACOSX)
#include "content/common/zygote_fork_delegate_linux.h"
#include "content/public/common/zygote_fork_delegate_linux.h"
#endif
#endif // OS_POSIX
......@@ -68,7 +68,7 @@ extern int WorkerMain(const MainFunctionParams&);
extern int UtilityMain(const MainFunctionParams&);
#if defined(OS_POSIX) && !defined(OS_MACOSX)
extern int ZygoteMain(const MainFunctionParams&,
ZygoteForkDelegate* forkdelegate);
content::ZygoteForkDelegate* forkdelegate);
#endif
namespace {
......@@ -192,7 +192,7 @@ int RunZygote(const MainFunctionParams& main_function_params,
{ switches::kPpapiPluginProcess, PpapiPluginMain },
};
scoped_ptr<ZygoteForkDelegate> zygote_fork_delegate;
scoped_ptr<content::ZygoteForkDelegate> zygote_fork_delegate;
if (delegate) zygote_fork_delegate.reset(delegate->ZygoteStarting());
// This function call can return multiple times, once per fork().
......
......@@ -37,9 +37,9 @@
#include "content/common/seccomp_sandbox.h"
#include "content/common/set_process_title.h"
#include "content/common/unix_domain_socket_posix.h"
#include "content/common/zygote_fork_delegate_linux.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/zygote_fork_delegate_linux.h"
#include "skia/ext/SkFontHost_fontconfig_control.h"
#include "unicode/timezone.h"
#include "ipc/ipc_channel.h"
......@@ -94,7 +94,7 @@ static void SELinuxTransitionToTypeOrDie(const char* type) {
// runs it.
class Zygote {
public:
Zygote(int sandbox_flags, ZygoteForkDelegate* helper)
Zygote(int sandbox_flags, content::ZygoteForkDelegate* helper)
: sandbox_flags_(sandbox_flags), helper_(helper) {
if (helper_)
helper_->InitialUMA(&initial_uma_name_,
......@@ -535,7 +535,7 @@ class Zygote {
ProcessMap real_pids_to_sandbox_pids;
const int sandbox_flags_;
ZygoteForkDelegate* helper_;
content::ZygoteForkDelegate* helper_;
// These might be set by helper_->InitialUMA. They supply a UMA
// enumeration sample we should report on the first fork.
......@@ -806,7 +806,7 @@ static bool EnterSandbox() {
#endif // CHROMIUM_SELINUX
bool ZygoteMain(const MainFunctionParams& params,
ZygoteForkDelegate* forkdelegate) {
content::ZygoteForkDelegate* forkdelegate) {
#if !defined(CHROMIUM_SELINUX)
g_am_zygote_or_renderer = true;
#endif
......
......@@ -51,6 +51,7 @@
'public/common/url_constants.h',
'public/common/url_fetcher_delegate.h',
'public/common/view_types.h',
'public/common/zygote_fork_delegate_linux.h',
'common/appcache/appcache_backend_proxy.cc',
'common/appcache/appcache_backend_proxy.h',
'common/appcache/appcache_dispatcher.cc',
......
......@@ -11,10 +11,11 @@
#include "build/build_config.h"
struct MainFunctionParams;
class ZygoteForkDelegate;
namespace content {
class ZygoteForkDelegate;
class ContentMainDelegate {
public:
virtual ~ContentMainDelegate() {}
......@@ -61,7 +62,7 @@ class ContentMainDelegate {
#elif defined(OS_POSIX)
// Tells the embedder that the zygote process is starting, and allows it to
// specify a zygote delegate if it wishes.
virtual ZygoteForkDelegate* ZygoteStarting() = 0;
virtual content::ZygoteForkDelegate* ZygoteStarting() = 0;
// Called every time the zygote process forks.
virtual void ZygoteForked() = 0;
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
#define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
#ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
#define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
#pragma once
#include <unistd.h>
......@@ -11,7 +11,7 @@
#include <string>
#include <vector>
#include "base/basictypes.h"
namespace content {
// The ZygoteForkDelegate allows the Chrome Linux zygote to delegate
// fork operations to another class that knows how to do some
......@@ -22,7 +22,6 @@ class ZygoteForkDelegate {
// initialization, and provides "fork()" functionality as an
// alternative to forking the zygote. A new delegate is passed in
// as an argument to ZygoteMain().
ZygoteForkDelegate() {}
virtual ~ZygoteForkDelegate() {}
// Initialization happens in the zygote after it has been
......@@ -54,4 +53,7 @@ class ZygoteForkDelegate {
// channel switch as a part of acknowledgement message.
virtual bool AckChild(int fd, const std::string& channel_switch) = 0;
};
#endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
} // namespace content
#endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
......@@ -59,7 +59,7 @@ bool ShellMainDelegate::DelaySandboxInitialization(
}
#elif defined(OS_POSIX)
ZygoteForkDelegate* ShellMainDelegate::ZygoteStarting() {
content::ZygoteForkDelegate* ShellMainDelegate::ZygoteStarting() {
return NULL;
}
......
......@@ -37,7 +37,7 @@ class ShellMainDelegate : public content::ContentMainDelegate {
virtual bool DelaySandboxInitialization(
const std::string& process_type) OVERRIDE;
#elif defined(OS_POSIX)
virtual ZygoteForkDelegate* ZygoteStarting() OVERRIDE;
virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE;
virtual void ZygoteForked() OVERRIDE;
#endif // OS_MACOSX
......
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