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

Unified Diff: content/browser/service_worker/service_worker_process_manager.cc

Issue 2927973002: Only use SiteInstance process reuse for ServiceWorker with no failures (Closed)
Patch Set: Created 3 years, 6 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: content/browser/service_worker/service_worker_process_manager.cc
diff --git a/content/browser/service_worker/service_worker_process_manager.cc b/content/browser/service_worker/service_worker_process_manager.cc
index b7fbe590ba6c1bc747066ef2c9f6c6d26fe3bfdd..cedb5d9c5d14a2caac94e0713bed7ae7b58685a8 100644
--- a/content/browser/service_worker/service_worker_process_manager.cc
+++ b/content/browser/service_worker/service_worker_process_manager.cc
@@ -216,14 +216,18 @@ void ServiceWorkerProcessManager::AllocateWorkerProcess(
}
}
- // No existing processes available; start a new one.
+ // ServiceWorkerProcessManager does not know of any renderer processes that
+ // are available for |pattern|. Create a SiteInstance and ask for a renderer
+ // process. Attempt to reuse an existing process if possible.
// TODO(clamy): Update the process reuse mechanism above following the
// implementation of
// SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE.
scoped_refptr<SiteInstanceImpl> site_instance =
SiteInstanceImpl::CreateForURL(browser_context_, script_url);
- site_instance->set_process_reuse_policy(
- SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE);
+ if (can_use_existing_process) {
+ site_instance->set_process_reuse_policy(
+ SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE);
+ }
RenderProcessHost* rph = site_instance->GetProcess();
// This Init() call posts a task to the IO thread that adds the RPH's

Powered by Google App Engine
This is Rietveld 408576698