Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1585)

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2248583003: Force release the worker ref count to release the process in BrowserContext::NotifyWillBeDestroyed() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}

Powered by Google App Engine
This is Rietveld 408576698