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

Unified Diff: content/browser/web_contents/render_view_host_manager.cc

Issue 10575014: Move process-per-site logic from BrowsingInstance to RenderProcessHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up RPHs in test. Created 8 years, 6 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/web_contents/render_view_host_manager.cc
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc
index a440682fe717a3c72186c13fef1a9bacc033150d..177d5c4df93d7121acb48cf266965f7adb9d9775 100644
--- a/content/browser/web_contents/render_view_host_manager.cc
+++ b/content/browser/web_contents/render_view_host_manager.cc
@@ -29,6 +29,7 @@
using content::NavigationController;
using content::NavigationEntry;
using content::NavigationEntryImpl;
+using content::RenderProcessHost;
using content::RenderViewHost;
using content::RenderViewHostImpl;
using content::RenderWidgetHostView;
@@ -255,7 +256,7 @@ void RenderViewHostManager::RendererAbortedProvisionalLoad(
}
void RenderViewHostManager::RendererProcessClosing(
- content::RenderProcessHost* render_process_host) {
+ RenderProcessHost* render_process_host) {
// Remove any swapped out RVHs from this process, so that we don't try to
// swap them back in while the process is exiting. Start by finding them,
// since there could be more than one.
@@ -344,7 +345,7 @@ void RenderViewHostManager::Observe(
switch (type) {
case content::NOTIFICATION_RENDERER_PROCESS_CLOSING:
RendererProcessClosing(
- content::Source<content::RenderProcessHost>(source).ptr());
+ content::Source<RenderProcessHost>(source).ptr());
break;
default:
@@ -463,8 +464,18 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
// to compare against the current URL and not the SiteInstance's site. In
// this case, there is no current URL, so comparing against the site is ok.
// See additional comments below.)
- if (curr_site_instance->HasRelatedSiteInstance(dest_url))
+ //
+ // Also, if the URL should use process-per-site mode and there is an
+ // existing process for the site, we should use it. We can call
+ // GetRelatedSiteInstance for this, which will eagerly set the site and
awong 2012/06/27 00:26:54 GetRelatedSiteInstance -> GetRelatedSiteInstance()
Charlie Reis 2012/06/27 20:53:43 Done.
+ // thus use the correct process.
+ bool use_process_per_site =
+ RenderProcessHost::ShouldUseProcessPerSite(browser_context, dest_url) &&
+ RenderProcessHost::GetProcessHostForSite(browser_context, dest_url);
+ if (curr_site_instance->HasRelatedSiteInstance(dest_url) ||
+ use_process_per_site) {
return curr_site_instance->GetRelatedSiteInstance(dest_url);
+ }
// For extensions, Web UI URLs (such as the new tab page), and apps we do
// not want to use the curr_instance if it has no site, since it will have a

Powered by Google App Engine
This is Rietveld 408576698