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 126df71c74b3b788f1836af075d0ad7733688228..54d19daa76cdb43f7d018033b5827c3866899e06 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -675,6 +675,7 @@ RenderProcessHostImpl::RenderProcessHostImpl( |
child_token_(mojo::edk::GenerateRandomToken()), |
service_worker_ref_count_(0), |
shared_worker_ref_count_(0), |
+ is_worker_ref_count_disabled_(false), |
visible_widgets_(0), |
is_process_backgrounded_(false), |
is_initialized_(false), |
@@ -1341,6 +1342,7 @@ bool RenderProcessHostImpl::IsProcessBackgrounded() const { |
void RenderProcessHostImpl::IncrementServiceWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ DCHECK(!is_worker_ref_count_disabled_); |
++service_worker_ref_count_; |
if (worker_ref_count() > max_worker_count_) |
max_worker_count_ = worker_ref_count(); |
@@ -1348,7 +1350,8 @@ void RenderProcessHostImpl::IncrementServiceWorkerRefCount() { |
void RenderProcessHostImpl::DecrementServiceWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- DCHECK_GT(worker_ref_count(), 0UL); |
+ DCHECK(!is_worker_ref_count_disabled_); |
+ DCHECK_GT(worker_ref_count(), 0U); |
--service_worker_ref_count_; |
if (worker_ref_count() == 0) |
Cleanup(); |
@@ -1356,6 +1359,7 @@ void RenderProcessHostImpl::DecrementServiceWorkerRefCount() { |
void RenderProcessHostImpl::IncrementSharedWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ DCHECK(!is_worker_ref_count_disabled_); |
++shared_worker_ref_count_; |
if (worker_ref_count() > max_worker_count_) |
max_worker_count_ = worker_ref_count(); |
@@ -1363,12 +1367,28 @@ void RenderProcessHostImpl::IncrementSharedWorkerRefCount() { |
void RenderProcessHostImpl::DecrementSharedWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- DCHECK_GT(worker_ref_count(), 0UL); |
+ DCHECK(!is_worker_ref_count_disabled_); |
+ DCHECK_GT(worker_ref_count(), 0U); |
--shared_worker_ref_count_; |
if (worker_ref_count() == 0) |
Cleanup(); |
} |
+void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ is_worker_ref_count_disabled_ = true; |
jam
2016/09/14 17:10:49
DCHECK(!is_worker_ref_count_disabled_); before thi
falken
2016/09/21 08:59:43
Done.
|
+ if (!worker_ref_count()) |
+ return; |
+ service_worker_ref_count_ = 0; |
+ shared_worker_ref_count_ = 0; |
+ Cleanup(); |
+} |
+ |
+bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ return is_worker_ref_count_disabled_; |
+} |
+ |
void RenderProcessHostImpl::PurgeAndSuspend() { |
Send(new ChildProcessMsg_PurgeAndSuspend()); |
} |