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

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

Issue 1853333003: [BlobAsync] Faster shortcuttin, make renderer controller leaky & alive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabling fast shutdown when transfering blobs Created 4 years, 8 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 b3425b0d72e0ed354646da8c802154312fdf1f17..9496cf1052a219f97fe7abc06ae97ba444c17b7b 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -559,7 +559,7 @@ RenderProcessHostImpl::RenderProcessHostImpl(
id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
browser_context_(browser_context),
storage_partition_impl_(storage_partition_impl),
- sudden_termination_allowed_(true),
+ sudden_termination_blocking_refcount_(0),
ignore_input_events_(false),
is_for_guests_only_(is_for_guests_only),
gpu_observer_registered_(false),
@@ -956,7 +956,10 @@ void RenderProcessHostImpl::CreateMessageFilters() {
GetID(), storage_partition_impl_->GetURLRequestContext(),
storage_partition_impl_->GetFileSystemContext(),
blob_storage_context.get(), StreamContext::GetFor(browser_context)));
- AddFilter(new BlobDispatcherHost(blob_storage_context.get()));
+ AddFilter(new BlobDispatcherHost(
+ blob_storage_context.get(),
+ base::Bind(&RenderProcessHostImpl::SetSuddenTerminationAllowed,
+ base::Unretained(this))));
AddFilter(new FileUtilitiesMessageFilter(GetID()));
AddFilter(new MimeRegistryMessageFilter());
AddFilter(
@@ -1680,7 +1683,7 @@ bool RenderProcessHostImpl::FastShutdownIfPossible() {
!GetHandle())
return false; // Render process hasn't started or is probably crashed.
- // Test if there's an unload listener.
+ // Test if there's an unload listener or blobs waiting to be transferred.
// NOTE: It's possible that an onunload listener may be installed
// while we're shutting down, so there's a small race here. Given that
// the window is small, it's unlikely that the web page has much
@@ -1972,11 +1975,11 @@ void RenderProcessHostImpl::RemovePendingView() {
}
void RenderProcessHostImpl::SetSuddenTerminationAllowed(bool enabled) {
- sudden_termination_allowed_ = enabled;
+ sudden_termination_blocking_refcount_ += enabled ? -1 : 1;
}
bool RenderProcessHostImpl::SuddenTerminationAllowed() const {
- return sudden_termination_allowed_;
+ return sudden_termination_blocking_refcount_ <= 0;
}
base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const {

Powered by Google App Engine
This is Rietveld 408576698