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 e090465bde26b3b389346bd4206085a71c4ef255..a205a6a31b93a8295acc55e76a1f74509691e6ce 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -1370,20 +1370,24 @@ bool RenderProcessHostImpl::IsProcessBackgrounded() const { |
return is_process_backgrounded_; |
} |
+size_t RenderProcessHostImpl::GetWorkerRefCount() const { |
+ return service_worker_ref_count_ + shared_worker_ref_count_; |
horo
2016/12/13 06:29:33
DCHECK_CURRENTLY_ON(BrowserThread::UI);
shimazu
2016/12/13 07:24:50
Done.
|
+} |
+ |
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(); |
+ if (GetWorkerRefCount() > max_worker_count_) |
+ max_worker_count_ = GetWorkerRefCount(); |
} |
void RenderProcessHostImpl::DecrementServiceWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
DCHECK(!is_worker_ref_count_disabled_); |
- DCHECK_GT(worker_ref_count(), 0U); |
+ DCHECK_GT(GetWorkerRefCount(), 0U); |
--service_worker_ref_count_; |
- if (worker_ref_count() == 0) |
+ if (GetWorkerRefCount() == 0) |
Cleanup(); |
} |
@@ -1391,16 +1395,16 @@ 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(); |
+ if (GetWorkerRefCount() > max_worker_count_) |
+ max_worker_count_ = GetWorkerRefCount(); |
} |
void RenderProcessHostImpl::DecrementSharedWorkerRefCount() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
DCHECK(!is_worker_ref_count_disabled_); |
- DCHECK_GT(worker_ref_count(), 0U); |
+ DCHECK_GT(GetWorkerRefCount(), 0U); |
--shared_worker_ref_count_; |
- if (worker_ref_count() == 0) |
+ if (GetWorkerRefCount() == 0) |
Cleanup(); |
} |
@@ -1408,7 +1412,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
DCHECK(!is_worker_ref_count_disabled_); |
is_worker_ref_count_disabled_ = true; |
- if (!worker_ref_count()) |
+ if (!GetWorkerRefCount()) |
return; |
service_worker_ref_count_ = 0; |
shared_worker_ref_count_ = 0; |
@@ -1934,7 +1938,7 @@ bool RenderProcessHostImpl::FastShutdownIfPossible() { |
if (!SuddenTerminationAllowed()) |
return false; |
- if (worker_ref_count() != 0) { |
+ if (GetWorkerRefCount() != 0) { |
if (survive_for_worker_start_time_.is_null()) |
survive_for_worker_start_time_ = base::TimeTicks::Now(); |
return false; |
@@ -2112,13 +2116,13 @@ void RenderProcessHostImpl::Cleanup() { |
delayed_cleanup_needed_ = false; |
// Records the time when the process starts surviving for workers for UMA. |
- if (listeners_.IsEmpty() && worker_ref_count() > 0 && |
+ if (listeners_.IsEmpty() && GetWorkerRefCount() > 0 && |
survive_for_worker_start_time_.is_null()) { |
survive_for_worker_start_time_ = base::TimeTicks::Now(); |
} |
// Until there are no other owners of this object, we can't delete ourselves. |
- if (!listeners_.IsEmpty() || worker_ref_count() != 0) |
+ if (!listeners_.IsEmpty() || GetWorkerRefCount() != 0) |
return; |
#if BUILDFLAG(ENABLE_WEBRTC) |