diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-02 20:24:49 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-02 20:24:49 +0000 |
commit | 4cb4310995f3b92adceb1e44b792726f7fc8249c (patch) | |
tree | 1b8217ee615f97dee3e42aa5794488fb6e31f058 /content/browser/utility_process_host.cc | |
parent | 9d43955551544e2954c4e085c8b34c866543f38e (diff) | |
download | chromium_src-4cb4310995f3b92adceb1e44b792726f7fc8249c.zip chromium_src-4cb4310995f3b92adceb1e44b792726f7fc8249c.tar.gz chromium_src-4cb4310995f3b92adceb1e44b792726f7fc8249c.tar.bz2 |
Don't make classes derive from ChildProcessHost, and instead have them use it through composition. This cleans up the code and makes it easier to understand (as well as more closely conform to the Google C++ style guide). It also makes it possible to add an interface around ChildProcessHost in a future change.
BUG=98716
Review URL: http://codereview.chromium.org/8774040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/utility_process_host.cc')
-rw-r--r-- | content/browser/utility_process_host.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc index 65a7e70..8bc2234 100644 --- a/content/browser/utility_process_host.cc +++ b/content/browser/utility_process_host.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" +#include "content/common/child_process_host.h" #include "content/common/utility_messages.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h" @@ -40,9 +41,9 @@ UtilityProcessHost::UtilityProcessHost(Client* client, is_batch_mode_(false), no_sandbox_(false), #if defined(OS_LINUX) - child_flags_(CHILD_ALLOW_SELF), + child_flags_(ChildProcessHost::CHILD_ALLOW_SELF), #else - child_flags_(CHILD_NORMAL), + child_flags_(ChildProcessHost::CHILD_NORMAL), #endif started_(false) { } @@ -72,7 +73,7 @@ void UtilityProcessHost::EndBatchMode() { } FilePath UtilityProcessHost::GetUtilityProcessCmd() { - return GetChildPath(child_flags_); + return ChildProcessHost::GetChildPath(child_flags_); } bool UtilityProcessHost::StartProcess() { @@ -86,7 +87,7 @@ bool UtilityProcessHost::StartProcess() { // launches a UtilityProcessHost. set_name(ASCIIToUTF16("utility process")); - if (!CreateChannel()) + if (!child_process_host()->CreateChannel()) return false; FilePath exe_path = GetUtilityProcessCmd(); @@ -98,7 +99,8 @@ bool UtilityProcessHost::StartProcess() { CommandLine* cmd_line = new CommandLine(exe_path); cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kUtilityProcess); - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); + cmd_line->AppendSwitchASCII(switches::kProcessChannelID, + child_process_host()->channel_id()); std::string locale = content::GetContentClient()->browser()->GetApplicationLocale(); cmd_line->AppendSwitchASCII(switches::kLang, locale); @@ -151,7 +153,3 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) { client_thread_id_, FROM_HERE, base::Bind(&Client::OnProcessCrashed, client_.get(), exit_code)); } - -bool UtilityProcessHost::CanShutdown() { - return true; -} |