Chromium Code Reviews| Index: content/browser/renderer_host/render_process_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
| index 80d37be2840e774cf57bf6f455e4763a90acb629..6c1ba8db92524ddbd397e5bb3023f69383cc0cfe 100644 |
| --- a/content/browser/renderer_host/render_process_host_impl.cc |
| +++ b/content/browser/renderer_host/render_process_host_impl.cc |
| @@ -398,7 +398,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( |
| power_monitor_broadcaster_(this), |
| geolocation_dispatcher_host_(NULL), |
| weak_factory_(this), |
| - screen_orientation_dispatcher_host_(NULL) { |
| + screen_orientation_dispatcher_host_(NULL), |
| + shared_worker_has_clients_(false) { |
| widget_helper_ = new RenderWidgetHelper(); |
| ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
| @@ -1227,6 +1228,9 @@ bool RenderProcessHostImpl::FastShutdownIfPossible() { |
| if (!SuddenTerminationAllowed()) |
| return false; |
| + if (shared_worker_has_clients_) |
| + return false; |
| + |
| // Set this before ProcessDied() so observers can tell if the render process |
| // died due to fast shutdown versus another cause. |
| fast_shutdown_started_ = true; |
| @@ -1452,7 +1456,7 @@ void RenderProcessHostImpl::Cleanup() { |
| delayed_cleanup_needed_ = false; |
| // When there are no other owners of this object, we can delete ourselves. |
| - if (listeners_.IsEmpty()) { |
| + if (listeners_.IsEmpty() && !shared_worker_has_clients_) { |
| // We cannot clean up twice; if this fails, there is an issue with our |
| // control flow. |
| DCHECK(!deleting_soon_); |
| @@ -2083,4 +2087,12 @@ void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { |
| } |
| #endif |
| +void RenderProcessHostImpl::NotifySharedWorkerHasClients( |
| + bool shared_worker_has_clients) { |
|
jam
2014/03/04 17:14:41
nit: indentation
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + shared_worker_has_clients_ = shared_worker_has_clients; |
| + if (!shared_worker_has_clients_) |
| + Cleanup(); |
| +} |
| + |
| } // namespace content |