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

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

Issue 176843004: Add IncrementWorkerRefCount() and DecrementWorkerRefCount() to RenderProcessHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 bb18da330e9f8255b66d1150639c68523fd27317..a12f1a42082238b30b66ea854e596f2f19f5c910 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),
+ has_external_worker_client_(false) {
widget_helper_ = new RenderWidgetHelper();
ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
@@ -1227,6 +1228,9 @@ bool RenderProcessHostImpl::FastShutdownIfPossible() {
if (!SuddenTerminationAllowed())
return false;
+ if (has_external_worker_client_)
+ 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() && !has_external_worker_client_) {
// 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::SetExternalClientStatus(
+ bool has_external_worker_client) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ has_external_worker_client_ = has_external_worker_client;
+ if (!has_external_worker_client)
+ Cleanup();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698