Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index a50ec9c41986b3ee99d17e4f52b44b01956108ef..bc33228427c07415f668cdef5fae141b925b9203 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -98,10 +98,6 @@ void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { |
site_instance->GetProcess()->mark_is_extension_process(); |
- // Register the association between extension and process with |
- // ExtensionProcessManager. |
- process_manager->RegisterExtensionProcess(extension->id(), process->id()); |
- |
if (extension->is_app()) { |
render_view_host->Send( |
new ExtensionMsg_ActivateApplication(extension->id())); |
@@ -194,6 +190,35 @@ GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile, |
return extension->GetResourceURL(url.path()); |
} |
+bool ChromeContentBrowserClient::ShouldUseProcessPerSite(Profile* profile, |
+ const GURL& url) { |
Matt Perry
2011/07/08 22:18:35
rename url to effective_url to clarify expectation
Charlie Reis
2011/07/08 22:49:50
Done.
|
+ // Non-extension URLs should generally use process-per-site-instance. |
+ // We expect url to be the effective URL, so hosted apps URLs should have |
+ // an extension scheme by now. |
+ if (!url.SchemeIs(chrome::kExtensionScheme)) |
+ return false; |
+ |
+ if (!profile || !profile->GetExtensionService()) |
+ return false; |
+ |
+ const Extension* extension = |
+ profile->GetExtensionService()->GetExtensionByURL(url); |
+ if (!extension) |
+ return false; |
+ |
+ // If the URL is part of a hosted app that does not have the background |
+ // permission, we want to give each instance its own process to improve |
+ // responsiveness. |
+ if (extension->GetType() == Extension::TYPE_HOSTED_APP && |
+ !extension->HasAPIPermission(ExtensionAPIPermission::kBackground)) |
+ return false; |
+ |
+ // Hosted apps that have the background permission must use process per site, |
+ // since all instances can make synchronous calls to the background window. |
+ // Other extensions should use process per site as well. |
+ return true; |
+} |
+ |
bool ChromeContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { |
return url == GURL(chrome::kChromeUICrashURL) || |
url == GURL(chrome::kChromeUIKillURL) || |