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

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

Issue 1723016: Force extensions to run in their shared processes, even with --process-per-tab. (Closed)
Patch Set: feedback Created 10 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
« no previous file with comments | « chrome/browser/browsing_instance.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_host_manager.cc
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index 73cf51f4ac191fa37e2062a6c25d4a37a756c1c2..58f488b6fae2e59a1aec034db98f453bb900329d 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -288,8 +288,16 @@ bool RenderViewHostManager::ShouldTransitionCrossSite() {
bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
const NavigationEntry* cur_entry,
const NavigationEntry* new_entry) const {
- if (!cur_entry || !new_entry)
+ DCHECK(new_entry);
+
+ if (!cur_entry) {
+ // Always choose a new process when navigating to extension URLs. The
+ // process grouping logic will combine all of a given extension's pages
+ // into the same process.
+ if (new_entry->url().SchemeIs(chrome::kExtensionScheme))
+ return true;
return false;
+ }
// We can't switch a RenderView between view source and non-view source mode
// without screwing up the session history sometimes (when navigating between
@@ -569,13 +577,13 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
// Again, new_instance won't be deleted before the end of this method, so it
// is safe to use a normal pointer here.
SiteInstance* new_instance = curr_instance;
- if (ShouldTransitionCrossSite())
+ bool force_swap = ShouldSwapProcessesForNavigation(
+ delegate_->GetLastCommittedNavigationEntryForRenderManager(),
+ &entry);
+ if (ShouldTransitionCrossSite() || force_swap)
new_instance = GetSiteInstanceForEntry(entry, curr_instance);
- if (new_instance != curr_instance ||
- ShouldSwapProcessesForNavigation(
- delegate_->GetLastCommittedNavigationEntryForRenderManager(),
- &entry)) {
+ if (new_instance != curr_instance || force_swap) {
// New SiteInstance.
DCHECK(!cross_navigation_pending_);
« no previous file with comments | « chrome/browser/browsing_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698