diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 19:20:20 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 19:20:20 +0000 |
commit | ee01e6641130a8d8693fab9f6c876a8e7589ad42 (patch) | |
tree | 15d4b075c18e1172945cae251a6c6862eb91cdff | |
parent | 9371ece3daf3ae30cec6bcfce42a4daf75944481 (diff) | |
download | chromium_src-ee01e6641130a8d8693fab9f6c876a8e7589ad42.zip chromium_src-ee01e6641130a8d8693fab9f6c876a8e7589ad42.tar.gz chromium_src-ee01e6641130a8d8693fab9f6c876a8e7589ad42.tar.bz2 |
Ensure workers don't outlive crashed renderers.
Review URL: http://codereview.chromium.org/114035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16638 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 8631742..4749064 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -193,6 +193,13 @@ void ResourceMessageFilter::OnChannelConnected(int32 peer_pid) { resource_dispatcher_host_, ui_loop()); } +void ResourceMessageFilter::OnChannelError() { + NotificationService::current()->Notify( + NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, + Source<ResourceMessageFilter>(this), + NotificationService::NoDetails()); +} + // Called on the IPC thread: void ResourceMessageFilter::OnChannelClosing() { channel_ = NULL; diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index e9bd7a9..9f763f7 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -77,6 +77,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, // IPC::ChannelProxy::MessageFilter methods: virtual void OnFilterAdded(IPC::Channel* channel); virtual void OnChannelConnected(int32 peer_pid); + virtual void OnChannelError(); virtual void OnChannelClosing(); virtual bool OnMessageReceived(const IPC::Message& message); diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc index 702e563..4849fb1 100644 --- a/chrome/browser/worker_host/worker_process_host.cc +++ b/chrome/browser/worker_host/worker_process_host.cc @@ -172,6 +172,7 @@ void WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { void WorkerProcessHost::SenderShutdown(IPC::Message::Sender* sender) { for (Instances::iterator i = instances_.begin(); i != instances_.end();) { if (i->sender == sender) { + Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id)); i = instances_.erase(i); } else { ++i; diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 340f5d1..c84d705 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -170,7 +170,9 @@ class NotificationType { SSL_INTERNAL_STATE_CHANGED, // Lets resource handlers and other interested observers know when the - // message filter is being deleted and can no longer be used. + // message filter is being deleted and can no longer be used. This will + // also get sent if the renderer crashes (and in that case, it'll be sent + // twice). RESOURCE_MESSAGE_FILTER_SHUTDOWN, // Views ------------------------------------------------------------------- |