diff options
Diffstat (limited to 'content/browser')
-rw-r--r-- | content/browser/browser_child_process_host.cc | 32 | ||||
-rw-r--r-- | content/browser/browser_child_process_host.h | 30 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 58 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 2 | ||||
-rw-r--r-- | content/browser/plugin_data_remover_impl.cc | 1 | ||||
-rw-r--r-- | content/browser/plugin_loader_posix.cc | 1 | ||||
-rw-r--r-- | content/browser/plugin_process_host.cc | 21 | ||||
-rw-r--r-- | content/browser/plugin_process_host.h | 6 | ||||
-rw-r--r-- | content/browser/ppapi_plugin_process_host.cc | 14 | ||||
-rw-r--r-- | content/browser/ppapi_plugin_process_host.h | 1 | ||||
-rw-r--r-- | content/browser/renderer_host/render_message_filter.cc | 3 | ||||
-rw-r--r-- | content/browser/utility_process_host.cc | 16 | ||||
-rw-r--r-- | content/browser/utility_process_host.h | 1 | ||||
-rw-r--r-- | content/browser/worker_host/worker_process_host.cc | 33 |
14 files changed, 124 insertions, 95 deletions
diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc index 508dade..3e56b6e 100644 --- a/content/browser/browser_child_process_host.cc +++ b/content/browser/browser_child_process_host.cc @@ -17,6 +17,7 @@ #include "content/browser/profiler_message_filter.h" #include "content/browser/renderer_host/resource_message_filter.h" #include "content/browser/trace_message_filter.h" +#include "content/common/child_process_host.h" #include "content/common/plugin_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h" @@ -59,10 +60,11 @@ BrowserChildProcessHost::BrowserChildProcessHost( #endif disconnect_was_alive_(false) { data_.type = type; - data_.id = GenerateChildProcessUniqueId(); + data_.id = ChildProcessHost::GenerateChildProcessUniqueId(); - AddFilter(new TraceMessageFilter); - AddFilter(new ProfilerMessageFilter); + child_process_host_.reset(new ChildProcessHost(this)); + child_process_host_->AddFilter(new TraceMessageFilter); + child_process_host_->AddFilter(new ProfilerMessageFilter); g_child_process_list.Get().push_back(this); } @@ -96,7 +98,7 @@ void BrowserChildProcessHost::Launch( #elif defined(OS_POSIX) use_zygote, environ, - channel()->TakeClientFileDescriptor(), + child_process_host()->channel()->TakeClientFileDescriptor(), #endif cmd_line, &client_)); @@ -112,7 +114,7 @@ base::ProcessHandle BrowserChildProcessHost::GetChildProcessHandle() const { void BrowserChildProcessHost::ForceShutdown() { g_child_process_list.Get().remove(this); - ChildProcessHost::ForceShutdown(); + child_process_host_->ForceShutdown(); } void BrowserChildProcessHost::SetTerminateChildOnShutdown( @@ -132,11 +134,19 @@ base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus( return child_process_->GetChildTerminationStatus(exit_code); } +bool BrowserChildProcessHost::OnMessageReceived(const IPC::Message& message) { + return false; +} + void BrowserChildProcessHost::OnChannelConnected(int32 peer_pid) { Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED); } -// The ChildProcessHost default implementation calls OnChildDied() always but at +bool BrowserChildProcessHost::CanShutdown() { + return true; +} + +// Normally a ChildProcessHostDelegate deletes itself from this callback, but at // this layer and below we need to have the final child process exit code to // properly bucket crashes vs kills. On Windows we can do this if we wait until // the process handle is signaled; on the rest of the platforms, we schedule a @@ -212,7 +222,7 @@ void BrowserChildProcessHost::OnChildDisconnected() { content::PROCESS_TYPE_MAX); // Notify in the main loop of the disconnection. Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED); - OnChildDied(); + delete this; } // The child process handle has been signaled so the exit code is finally @@ -226,13 +236,17 @@ void BrowserChildProcessHost::OnWaitableEventSignaled( GetExitCodeProcess(waitable_event->Release(), &exit_code); delete waitable_event; if (exit_code == STILL_ACTIVE) { - OnChildDied(); + delete this; } else { BrowserChildProcessHost::OnChildDisconnected(); } #endif } +bool BrowserChildProcessHost::Send(IPC::Message* message) { + return child_process_host_->Send(message); +} + void BrowserChildProcessHost::ShutdownStarted() { // Must remove the process from the list now, in case it gets used for a // new instance before our watcher tells us that the process terminated. @@ -245,7 +259,7 @@ BrowserChildProcessHost::ClientHook::ClientHook(BrowserChildProcessHost* host) void BrowserChildProcessHost::ClientHook::OnProcessLaunched() { if (!host_->child_process_->GetHandle()) { - host_->OnChildDied(); + delete host_; return; } host_->data_.handle = host_->child_process_->GetHandle(); diff --git a/content/browser/browser_child_process_host.h b/content/browser/browser_child_process_host.h index a201c30..561d84e 100644 --- a/content/browser/browser_child_process_host.h +++ b/content/browser/browser_child_process_host.h @@ -8,13 +8,17 @@ #include <list> +#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/process.h" #include "base/synchronization/waitable_event_watcher.h" #include "content/browser/child_process_launcher.h" -#include "content/common/child_process_host.h" #include "content/common/content_export.h" #include "content/public/browser/child_process_data.h" +#include "content/public/common/child_process_host_delegate.h" +#include "ipc/ipc_message.h" + +class ChildProcessHost; namespace base { class WaitableEvent; @@ -26,9 +30,10 @@ class WaitableEvent; // [Browser]RenderProcessHost is the main exception that doesn't derive from // this class. That project lives on the UI thread. class CONTENT_EXPORT BrowserChildProcessHost : - public ChildProcessHost, + public content::ChildProcessHostDelegate, public ChildProcessLauncher::Client, - public base::WaitableEventWatcher::Delegate { + public base::WaitableEventWatcher::Delegate, + public IPC::Message::Sender { public: virtual ~BrowserChildProcessHost(); @@ -58,6 +63,9 @@ class CONTENT_EXPORT BrowserChildProcessHost : std::list<BrowserChildProcessHost*>::iterator iterator_; }; + // IPC::Message::Sender override + virtual bool Send(IPC::Message* message) OVERRIDE; + const content::ChildProcessData& data() const { return data_; } content::ProcessType type() const { return data_.type; } const string16& name() const { return data_.name; } @@ -102,13 +110,15 @@ class CONTENT_EXPORT BrowserChildProcessHost : // GetExitCodeProcess()). |exit_code| may be NULL. virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); - // Overrides from ChildProcessHost - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; + // ChildProcessHostDelegate implementation: + virtual bool CanShutdown() OVERRIDE; virtual void OnChildDisconnected() OVERRIDE; virtual void ShutdownStarted() OVERRIDE; - // Extends the base class implementation and removes this host from - // the host list. Calls ChildProcessHost::ForceShutdown - virtual void ForceShutdown() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; + + // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown + void ForceShutdown(); // Controls whether the child process should be terminated on browser // shutdown. Default is to always terminate. @@ -117,6 +127,9 @@ class CONTENT_EXPORT BrowserChildProcessHost : // Sends the given notification on the UI thread. void Notify(int type); + ChildProcessHost* child_process_host() const { + return child_process_host_.get(); + } void set_name(const string16& name) { data_.name = name; } void set_handle(base::ProcessHandle handle) { data_.handle = handle; } @@ -133,6 +146,7 @@ class CONTENT_EXPORT BrowserChildProcessHost : }; content::ChildProcessData data_; + scoped_ptr<ChildProcessHost> child_process_host_; ClientHook client_; scoped_ptr<ChildProcessLauncher> child_process_; diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index cdaac3e..3b18d38 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -17,6 +17,7 @@ #include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/common/child_process_host.h" #include "content/common/gpu/gpu_messages.h" #include "content/gpu/gpu_child_thread.h" #include "content/gpu/gpu_process.h" @@ -279,6 +280,25 @@ GpuProcessHost::GpuProcessHost(int host_id) GpuProcessHost::~GpuProcessHost() { DCHECK(CalledOnValidThread()); + + SendOutstandingReplies(); + UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", + DIED_FIRST_TIME + g_gpu_crash_count, + GPU_PROCESS_LIFETIME_EVENT_MAX); + + int exit_code; + base::TerminationStatus status = GetChildTerminationStatus(&exit_code); + UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus", + status, + base::TERMINATION_STATUS_MAX_ENUM); + + if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION || + status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { + UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessExitCode", + exit_code, + content::RESULT_CODE_LAST_CODE); + } + #if defined(OS_WIN) if (gpu_process_) CloseHandle(gpu_process_); @@ -299,14 +319,15 @@ GpuProcessHost::~GpuProcessHost() { } bool GpuProcessHost::Init() { - if (!CreateChannel()) + if (!child_process_host()->CreateChannel()) return false; if (in_process_) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisableGpuWatchdog); - in_process_gpu_thread_.reset(new GpuMainThread(channel_id())); + in_process_gpu_thread_.reset(new GpuMainThread( + child_process_host()->channel_id())); base::Thread::Options options; #if defined(OS_WIN) @@ -337,7 +358,7 @@ void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { bool GpuProcessHost::Send(IPC::Message* msg) { DCHECK(CalledOnValidThread()); - if (opening_channel()) { + if (child_process_host()->opening_channel()) { queued_messages_.push(msg); return true; } @@ -488,10 +509,6 @@ void GpuProcessHost::OnGraphicsInfoCollected(const content::GPUInfo& gpu_info) { GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info); } -bool GpuProcessHost::CanShutdown() { - return true; -} - void GpuProcessHost::OnProcessLaunched() { // Send the GPU process handle to the UI thread before it has to // respond to any requests to establish a GPU channel. The response @@ -513,30 +530,6 @@ void GpuProcessHost::OnProcessLaunched() { #endif } -void GpuProcessHost::OnChildDied() { - SendOutstandingReplies(); - // Located in OnChildDied because OnProcessCrashed suffers from a race - // condition on Linux. - UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", - DIED_FIRST_TIME + g_gpu_crash_count, - GPU_PROCESS_LIFETIME_EVENT_MAX); - - int exit_code; - base::TerminationStatus status = GetChildTerminationStatus(&exit_code); - UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus", - status, - base::TERMINATION_STATUS_MAX_ENUM); - - if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION || - status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { - UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessExitCode", - exit_code, - content::RESULT_CODE_LAST_CODE); - } - - ChildProcessHost::OnChildDied(); -} - void GpuProcessHost::OnProcessCrashed(int exit_code) { SendOutstandingReplies(); if (++g_gpu_crash_count >= kGpuMaxCrashCount) { @@ -575,7 +568,8 @@ bool GpuProcessHost::LaunchGpuProcess() { CommandLine* cmd_line = new CommandLine(exe_path); cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); + cmd_line->AppendSwitchASCII(switches::kProcessChannelID, + child_process_host()->channel_id()); // Propagate relevant command line switches. static const char* const kSwitchNames[] = { diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index e6ba2c0..073e8fd 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -92,9 +92,7 @@ class GpuProcessHost : public BrowserChildProcessHost, // Post an IPC message to the UI shim's message handler on the UI thread. void RouteOnUIThread(const IPC::Message& message); - virtual bool CanShutdown() OVERRIDE; virtual void OnProcessLaunched() OVERRIDE; - virtual void OnChildDied() OVERRIDE; virtual void OnProcessCrashed(int exit_code) OVERRIDE; // Message handlers. diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc index da0dbfc..38489d5 100644 --- a/content/browser/plugin_data_remover_impl.cc +++ b/content/browser/plugin_data_remover_impl.cc @@ -10,6 +10,7 @@ #include "base/version.h" #include "content/browser/plugin_process_host.h" #include "content/browser/plugin_service.h" +#include "content/common/child_process_host.h" #include "content/common/plugin_messages.h" #include "content/public/browser/browser_thread.h" #include "webkit/plugins/npapi/plugin_group.h" diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc index 6d2be85..bc96427 100644 --- a/content/browser/plugin_loader_posix.cc +++ b/content/browser/plugin_loader_posix.cc @@ -8,6 +8,7 @@ #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "base/metrics/histogram.h" +#include "content/common/child_process_host.h" #include "content/common/utility_messages.h" #include "content/public/browser/browser_thread.h" #include "webkit/plugins/npapi/plugin_list.h" diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 91c22c4..293072d 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -22,6 +22,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "content/browser/plugin_service.h" +#include "content/common/child_process_host.h" #include "content/common/plugin_messages.h" #include "content/common/resource_messages.h" #include "content/public/browser/browser_thread.h" @@ -167,7 +168,7 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info, info_ = info; set_name(info_.name); - if (!CreateChannel()) + if (!child_process_host()->CreateChannel()) return false; // Build command line for plugin. When we have a plugin launcher, we can't @@ -180,14 +181,15 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info, // Run the plug-in process in a mode tolerant of heap execution without // explicit mprotect calls. Some plug-ins still rely on this quaint and // archaic "feature." See http://crbug.com/93551. - int flags = CHILD_ALLOW_HEAP_EXECUTION; + int flags = ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION; #elif defined(OS_LINUX) - int flags = plugin_launcher.empty() ? CHILD_ALLOW_SELF : CHILD_NORMAL; + int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : + ChildProcessHost::CHILD_NORMAL; #else - int flags = CHILD_NORMAL; + int flags = ChildProcessHost::CHILD_NORMAL; #endif - FilePath exe_path = GetChildPath(flags); + FilePath exe_path = ChildProcessHost::GetChildPath(flags); if (exe_path.empty()) return false; @@ -233,7 +235,8 @@ bool PluginProcessHost::Init(const webkit::WebPluginInfo& info, cmd_line->AppendSwitchASCII(switches::kLang, locale); } - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); + cmd_line->AppendSwitchASCII(switches::kProcessChannelID, + child_process_host()->channel_id()); #if defined(OS_POSIX) base::environment_vector env; @@ -279,6 +282,10 @@ void PluginProcessHost::ForceShutdown() { BrowserChildProcessHost::ForceShutdown(); } +void PluginProcessHost::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { + child_process_host()->AddFilter(filter); +} + bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) @@ -359,7 +366,7 @@ void PluginProcessHost::CancelPendingRequestsForResourceContext( void PluginProcessHost::OpenChannelToPlugin(Client* client) { Notify(content::NOTIFICATION_CHILD_INSTANCE_CREATED); client->SetPluginInfo(info_); - if (opening_channel()) { + if (child_process_host()->opening_channel()) { // The channel is already in the process of being opened. Put // this "open channel" request into a queue of requests that will // be run once the channel is open. diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h index b56183f..6ce5f08 100644 --- a/content/browser/plugin_process_host.h +++ b/content/browser/plugin_process_host.h @@ -17,6 +17,7 @@ #include "base/memory/ref_counted.h" #include "content/browser/browser_child_process_host.h" #include "content/common/content_export.h" +#include "ipc/ipc_channel_proxy.h" #include "webkit/plugins/webplugininfo.h" #include "ui/gfx/native_widget_types.h" @@ -69,7 +70,7 @@ class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHost { bool Init(const webkit::WebPluginInfo& info, const std::string& locale); // Force the plugin process to shutdown (cleanly). - virtual void ForceShutdown() OVERRIDE; + void ForceShutdown(); virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; @@ -109,6 +110,9 @@ class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHost { void AddWindow(HWND window); #endif + // Adds an IPC message filter. A reference will be kept to the filter. + void AddFilter(IPC::ChannelProxy::MessageFilter* filter); + private: // Sends a message to the plugin process to request creation of a new channel // for the given mime type. diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index 8b5faef..f4ccd33 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/render_message_filter.h" +#include "content/common/child_process_host.h" #include "content/common/child_process_messages.h" #include "content/public/common/content_switches.h" #include "content/public/common/pepper_plugin_info.h" @@ -84,7 +85,7 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( } void PpapiPluginProcessHost::OpenChannelToPlugin(Client* client) { - if (opening_channel()) { + if (child_process_host()->opening_channel()) { // The channel is already in the process of being opened. Put // this "open channel" request into a queue of requests that will // be run once the channel is open. @@ -102,7 +103,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) network_observer_(new PluginNetworkObserver(this)), is_broker_(false), process_id_(ChildProcessHost::GenerateChildProcessUniqueId()) { - AddFilter(filter_.get()); + child_process_host()->AddFilter(filter_.get()); } PpapiPluginProcessHost::PpapiPluginProcessHost() @@ -119,7 +120,7 @@ bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { set_name(UTF8ToUTF16(info.name)); } - if (!CreateChannel()) + if (!child_process_host()->CreateChannel()) return false; const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); @@ -140,7 +141,8 @@ bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { cmd_line->AppendSwitchASCII(switches::kProcessType, is_broker_ ? switches::kPpapiBrokerProcess : switches::kPpapiPluginProcess); - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); + cmd_line->AppendSwitchASCII(switches::kProcessChannelID, + child_process_host()->channel_id()); // These switches are forwarded to both plugin and broker pocesses. static const char* kCommonForwardSwitches[] = { @@ -198,10 +200,6 @@ void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { client->OnChannelOpened(base::kNullProcessHandle, IPC::ChannelHandle()); } -bool PpapiPluginProcessHost::CanShutdown() { - return true; -} - void PpapiPluginProcessHost::OnProcessLaunched() { } diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h index a968a27..f92aa1d 100644 --- a/content/browser/ppapi_plugin_process_host.h +++ b/content/browser/ppapi_plugin_process_host.h @@ -82,7 +82,6 @@ class PpapiPluginProcessHost void RequestPluginChannel(Client* client); - virtual bool CanShutdown() OVERRIDE; virtual void OnProcessLaunched() OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 267d1cc..f84b968 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -686,8 +686,7 @@ void RenderMessageFilter::OnCheckNotificationPermission( void RenderMessageFilter::OnAllocateSharedMemory( uint32 buffer_size, base::SharedMemoryHandle* handle) { - ChildProcessHost::OnAllocateSharedMemory( - buffer_size, peer_handle(), handle); + ChildProcessHost::AllocateSharedMemory(buffer_size, peer_handle(), handle); } net::URLRequestContext* RenderMessageFilter::GetRequestContextForURL( 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; -} diff --git a/content/browser/utility_process_host.h b/content/browser/utility_process_host.h index de53610..b81d12d 100644 --- a/content/browser/utility_process_host.h +++ b/content/browser/utility_process_host.h @@ -84,7 +84,6 @@ class CONTENT_EXPORT UtilityProcessHost : public BrowserChildProcessHost { // BrowserChildProcessHost: virtual void OnProcessCrashed(int exit_code) OVERRIDE; - virtual bool CanShutdown() OVERRIDE; // A pointer to our client interface, who will be informed of progress. scoped_refptr<Client> client_; diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index ba29447..68d75c9 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -31,6 +31,7 @@ #include "content/browser/worker_host/message_port_service.h" #include "content/browser/worker_host/worker_message_filter.h" #include "content/browser/worker_host/worker_service.h" +#include "content/common/child_process_host.h" #include "content/common/debug_flags.h" #include "content/common/view_messages.h" #include "content/common/worker_messages.h" @@ -111,22 +112,23 @@ WorkerProcessHost::~WorkerProcessHost() { } bool WorkerProcessHost::Init(int render_process_id) { - if (!CreateChannel()) + if (!child_process_host()->CreateChannel()) return false; #if defined(OS_LINUX) - int flags = CHILD_ALLOW_SELF; + int flags = ChildProcessHost::CHILD_ALLOW_SELF; #else - int flags = CHILD_NORMAL; + int flags = ChildProcessHost::CHILD_NORMAL; #endif - FilePath exe_path = GetChildPath(flags); + FilePath exe_path = ChildProcessHost::GetChildPath(flags); if (exe_path.empty()) return false; CommandLine* cmd_line = new CommandLine(exe_path); cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kWorkerProcess); - 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); @@ -237,29 +239,30 @@ void WorkerProcessHost::CreateMessageFilters(int render_process_id) { id(), content::PROCESS_TYPE_WORKER, resource_context_, new URLRequestContextSelector(request_context), resource_dispatcher_host_); - AddFilter(resource_message_filter); + child_process_host()->AddFilter(resource_message_filter); worker_message_filter_ = new WorkerMessageFilter( render_process_id, resource_context_, resource_dispatcher_host_, base::Bind(&WorkerService::next_worker_route_id, base::Unretained(WorkerService::GetInstance()))); - AddFilter(worker_message_filter_); - AddFilter(new AppCacheDispatcherHost( + child_process_host()->AddFilter(worker_message_filter_); + child_process_host()->AddFilter(new AppCacheDispatcherHost( resource_context_->appcache_service(), id())); - AddFilter(new FileSystemDispatcherHost( + child_process_host()->AddFilter(new FileSystemDispatcherHost( request_context, resource_context_->file_system_context())); - AddFilter(new FileUtilitiesMessageFilter(id())); - AddFilter(new BlobMessageFilter( + child_process_host()->AddFilter(new FileUtilitiesMessageFilter(id())); + child_process_host()->AddFilter(new BlobMessageFilter( id(), resource_context_->blob_storage_context())); - AddFilter(new MimeRegistryMessageFilter()); - AddFilter(new DatabaseMessageFilter( + child_process_host()->AddFilter(new MimeRegistryMessageFilter()); + child_process_host()->AddFilter(new DatabaseMessageFilter( resource_context_->database_tracker())); SocketStreamDispatcherHost* socket_stream_dispatcher_host = new SocketStreamDispatcherHost( new URLRequestContextSelector(request_context), resource_context_); - AddFilter(socket_stream_dispatcher_host); - AddFilter(new content::WorkerDevToolsMessageFilter(id())); + child_process_host()->AddFilter(socket_stream_dispatcher_host); + child_process_host()->AddFilter( + new content::WorkerDevToolsMessageFilter(id())); } void WorkerProcessHost::CreateWorker(const WorkerInstance& instance) { |