Skip to content
Snippets Groups Projects
Commit ab9dd531 authored by mpcomplete@chromium.org's avatar mpcomplete@chromium.org
Browse files

Force extensions to run in their shared processes, even with --process-per-tab.

BUG=36617

Review URL: http://codereview.chromium.org/1723016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45849 0039d316-1c4b-4281-b951-d872f2087c98
parent 05360bb1
No related merge requests found
......@@ -22,6 +22,12 @@ bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kProcessPerSite))
return true;
if (url.SchemeIs(chrome::kExtensionScheme)) {
// Always consolidate extensions regardless of the command line, because
// they will break if split into multiple processes.
return true;
}
if (!command_line.HasSwitch(switches::kProcessPerTab)) {
// We are not in process-per-site or process-per-tab, so we must be in the
......@@ -30,10 +36,9 @@ bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) {
// Note that --single-process may have been specified, but that affects the
// process creation logic in RenderProcessHost, so we do not need to worry
// about it here.
if (url.SchemeIs(chrome::kChromeUIScheme) ||
url.SchemeIs(chrome::kExtensionScheme))
if (url.SchemeIs(chrome::kChromeUIScheme))
// Always consolidate instances of the new tab page (and instances of any
// other internal resource urls), as well as extensions.
// other internal resource urls.
return true;
// TODO(creis): List any other special cases that we want to limit to a
......
......@@ -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_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment