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

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

Issue 10332146: Merge 136168 - Allow renderers to shut down if they only contain swapped out views. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1132/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
===================================================================
--- content/browser/renderer_host/render_process_host_impl.cc (revision 136908)
+++ content/browser/renderer_host/render_process_host_impl.cc (working copy)
@@ -128,6 +128,8 @@
using content::ChildProcessHostImpl;
using content::RenderWidgetHost;
using content::RenderWidgetHostImpl;
+using content::RenderViewHost;
+using content::RenderViewHostImpl;
using content::UserMetricsAction;
using content::WebUIControllerFactory;
@@ -1257,9 +1259,30 @@
}
void RenderProcessHostImpl::OnShutdownRequest() {
- // Don't shut down if there are more RenderViews than the one asking to
- // close, or if there are pending RenderViews being swapped back in.
- if (pending_views_ || render_widget_hosts_.size() > 1)
+ // Don't shut down if there are more active RenderViews than the one asking
+ // to close, or if there are pending RenderViews being swapped back in.
+ int num_active_views = 0;
+ for (RenderWidgetHostsIterator iter = GetRenderWidgetHostsIterator();
+ iter.IsAtEnd();
+ iter.Advance()) {
+ const RenderWidgetHost* widget = iter.GetCurrentValue();
+ DCHECK(widget);
+ if (!widget)
+ continue;
+
+ // All RenderWidgetHosts are swapped in.
+ if (!widget->IsRenderView()) {
+ num_active_views++;
+ continue;
+ }
+
+ // Don't count swapped out views.
+ RenderViewHost* rvh =
+ RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
+ if (!static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out())
+ num_active_views++;
+ }
+ if (pending_views_ || num_active_views > 1)
return;
// Notify any contents that might have swapped out renderers from this
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698