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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7328029: Use process-per-app-instance for hosted apps without background permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update tests. Created 9 years, 5 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: 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) ||

Powered by Google App Engine
This is Rietveld 408576698