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

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

Issue 7063015: Swap processes on reload if a hosted app has been installed/uninstalled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile on Windows Created 9 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 | « content/browser/tab_contents/navigation_entry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tab_contents/render_view_host_manager.cc
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index accb225b1c5808bb66ad55cab9b8864091770437..d827a087282cc5269e76233f4a8f4840aca65e37 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -393,9 +393,19 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
SiteInstance* curr_instance) {
// NOTE: This is only called when ShouldTransitionCrossSite is true.
- // If the entry has an instance already, we should use it.
- if (entry.site_instance())
- return entry.site_instance();
+ const GURL& dest_url = entry.url();
+ NavigationController& controller = delegate_->GetControllerForRenderManager();
+ Profile* profile = controller.profile();
+
+ // If the entry has an instance already we should use it, unless the URL
+ // is part of an app that has been installed or uninstalled since the last
+ // visit.
+ if (entry.site_instance()) {
+ if (entry.site_instance()->HasWrongProcessForURL(dest_url))
+ return curr_instance->GetRelatedSiteInstance(dest_url);
+ else
+ return entry.site_instance();
+ }
// (UGLY) HEURISTIC, process-per-site only:
//
@@ -411,10 +421,6 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
entry.transition_type() == PageTransition::GENERATED)
return curr_instance;
- const GURL& dest_url = entry.url();
- NavigationController& controller = delegate_->GetControllerForRenderManager();
- Profile* profile = controller.profile();
-
// If we haven't used our SiteInstance (and thus RVH) yet, then we can use it
// for this entry. We won't commit the SiteInstance to this site until the
// navigation commits (in DidNavigate), unless the navigation entry was
@@ -480,7 +486,11 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
const GURL& current_url = (curr_entry) ? curr_entry->url() :
curr_instance->site();
- if (SiteInstance::IsSameWebSite(profile, current_url, dest_url)) {
+ // Use the current SiteInstance for same site navigations, as long as the
+ // process type is correct. (The URL may have been installed as an app since
+ // the last time we visited it.)
+ if (SiteInstance::IsSameWebSite(profile, current_url, dest_url) &&
+ !curr_instance->HasWrongProcessForURL(dest_url)) {
return curr_instance;
} else if (ShouldSwapProcessesForNavigation(curr_entry, &entry)) {
// When we're swapping, we need to force the site instance AND browsing
« no previous file with comments | « content/browser/tab_contents/navigation_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698