diff options
-rw-r--r-- | chrome/service/service_child_process_host.cc | 13 | ||||
-rw-r--r-- | chrome/service/service_child_process_host.h | 14 | ||||
-rw-r--r-- | chrome/service/service_utility_process_host.cc | 8 |
3 files changed, 18 insertions, 17 deletions
diff --git a/chrome/service/service_child_process_host.cc b/chrome/service/service_child_process_host.cc index ef0de6a..234b899 100644 --- a/chrome/service/service_child_process_host.cc +++ b/chrome/service/service_child_process_host.cc @@ -15,13 +15,13 @@ #include "content/common/sandbox_policy.h" #endif // defined(OS_WIN) -ServiceChildProcessHost::ServiceChildProcessHost(ProcessType type) - : ChildProcessInfo(type, -1) { +ServiceChildProcessHost::ServiceChildProcessHost() + : handle_(base::kNullProcessHandle) { } ServiceChildProcessHost::~ServiceChildProcessHost() { // We need to kill the child process when the host dies. - base::KillProcess(handle(), content::RESULT_CODE_NORMAL_EXIT, false); + base::KillProcess(handle_, content::RESULT_CODE_NORMAL_EXIT, false); } bool ServiceChildProcessHost::Launch(CommandLine* cmd_line, @@ -36,11 +36,10 @@ bool ServiceChildProcessHost::Launch(CommandLine* cmd_line, if (no_sandbox) { base::ProcessHandle process = base::kNullProcessHandle; cmd_line->AppendSwitch(switches::kNoSandbox); - base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process); - set_handle(process); + base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle_); } else { - set_handle(sandbox::StartProcessWithAccess(cmd_line, exposed_dir)); + handle_ = sandbox::StartProcessWithAccess(cmd_line, exposed_dir); } - return (handle() != base::kNullProcessHandle); + return (handle_ != base::kNullProcessHandle); #endif // !defined(OS_WIN) } diff --git a/chrome/service/service_child_process_host.h b/chrome/service/service_child_process_host.h index 8994d1b..44337be 100644 --- a/chrome/service/service_child_process_host.h +++ b/chrome/service/service_child_process_host.h @@ -8,20 +8,19 @@ #include "base/process.h" #include "content/common/child_process_host.h" -#include "content/common/child_process_info.h" class CommandLine; // Plugins/workers and other child processes that live on the IO thread should // derive from this class. // -class ServiceChildProcessHost : public ChildProcessHost, - public ChildProcessInfo { +class ServiceChildProcessHost : public ChildProcessHost { public: virtual ~ServiceChildProcessHost(); protected: - explicit ServiceChildProcessHost(ProcessType type); + ServiceChildProcessHost(); + // Derived classes call this to launch the child process synchronously. // TODO(sanjeevr): Determine whether we need to make the launch asynchronous. // |exposed_dir| is the path to tbe exposed to the sandbox. This is ignored @@ -29,6 +28,13 @@ class ServiceChildProcessHost : public ChildProcessHost, bool Launch(CommandLine* cmd_line, bool no_sandbox, const FilePath& exposed_dir); + + base::ProcessHandle handle() const { return handle_; } + + private: + base::ProcessHandle handle_; + + DISALLOW_COPY_AND_ASSIGN(ServiceChildProcessHost); }; #endif // CHROME_SERVICE_SERVICE_CHILD_PROCESS_HOST_H_ diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index 9b359c3..2b4fe26 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -13,6 +13,7 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_utility_messages.h" +#include "content/common/child_process_info.h" #include "ipc/ipc_switches.h" #include "printing/page_range.h" #include "ui/base/ui_base_switches.h" @@ -27,8 +28,7 @@ ServiceUtilityProcessHost::ServiceUtilityProcessHost( Client* client, base::MessageLoopProxy* client_message_loop_proxy) - : ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS), - client_(client), + : client_(client), client_message_loop_proxy_(client_message_loop_proxy), waiting_for_reply_(false) { process_id_ = ChildProcessInfo::GenerateChildProcessUniqueId(); @@ -95,10 +95,6 @@ bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults( bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox, const FilePath& exposed_dir) { - // Name must be set or metrics_service will crash in any test which - // launches a UtilityProcessHost. - set_name(ASCIIToUTF16("utility process")); - if (!CreateChannel()) return false; |