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 423b74e9062919e14513f9e230282ed43640d30f..d6e2557692d044111db92607c7d77e715229dacc 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -615,6 +615,7 @@ RenderProcessHostImpl::RenderProcessHostImpl( |
#endif |
worker_ref_count_(0), |
max_worker_count_(0), |
+ worker_ref_count_disabled_(false), |
permission_service_context_(new PermissionServiceContext(this)), |
channel_connected_(false), |
sent_render_process_ready_(false), |
@@ -1248,6 +1249,7 @@ bool RenderProcessHostImpl::IsProcessBackgrounded() const { |
void RenderProcessHostImpl::IncrementWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ DCHECK(!worker_ref_count_disabled_); |
++worker_ref_count_; |
if (worker_ref_count_ > max_worker_count_) |
max_worker_count_ = worker_ref_count_; |
@@ -1255,12 +1257,22 @@ void RenderProcessHostImpl::IncrementWorkerRefCount() { |
void RenderProcessHostImpl::DecrementWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ DCHECK(!worker_ref_count_disabled_); |
DCHECK_GT(worker_ref_count_, 0); |
--worker_ref_count_; |
if (worker_ref_count_ == 0) |
Cleanup(); |
} |
+void RenderProcessHostImpl::ForceReleaseWorkerRefCount() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ worker_ref_count_disabled_ = true; |
+ if (!worker_ref_count_) |
+ return; |
+ worker_ref_count_ = 0; |
+ Cleanup(); |
+} |
+ |
void RenderProcessHostImpl::PurgeAndSuspend() { |
Send(new ChildProcessMsg_PurgeAndSuspend()); |
} |