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

Side by Side Diff: content/browser/service_worker/service_worker_process_manager.cc

Issue 2803673006: PlzNavigate: ensure we don't create extra-processes for ServiceWorkers (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_process_manager.h" 5 #include "content/browser/service_worker/service_worker_process_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 11
12 #include "content/browser/renderer_host/render_process_host_impl.h" 12 #include "content/browser/renderer_host/render_process_host_impl.h"
13 #include "content/browser/service_worker/service_worker_context_wrapper.h" 13 #include "content/browser/service_worker/service_worker_context_wrapper.h"
14 #include "content/browser/site_instance_impl.h"
14 #include "content/common/service_worker/embedded_worker_settings.h" 15 #include "content/common/service_worker/embedded_worker_settings.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/site_instance.h" 18 #include "content/public/browser/site_instance.h"
18 #include "content/public/common/child_process_host.h" 19 #include "content/public/common/child_process_host.h"
19 #include "content/public/common/content_client.h" 20 #include "content/public/common/content_client.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace content { 23 namespace content {
23 24
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 BrowserThread::PostTask( 206 BrowserThread::PostTask(
206 BrowserThread::IO, FROM_HERE, 207 BrowserThread::IO, FROM_HERE,
207 base::Bind(callback, SERVICE_WORKER_OK, process_id, 208 base::Bind(callback, SERVICE_WORKER_OK, process_id,
208 false /* is_new_process */, settings)); 209 false /* is_new_process */, settings));
209 return; 210 return;
210 } 211 }
211 } 212 }
212 213
213 // No existing processes available; start a new one. 214 // No existing processes available; start a new one.
214 scoped_refptr<SiteInstance> site_instance = 215 scoped_refptr<SiteInstance> site_instance =
215 SiteInstance::CreateForURL(browser_context_, script_url); 216 SiteInstanceImpl::FindOrCreateForURL(browser_context_, script_url);
216 RenderProcessHost* rph = site_instance->GetProcess(); 217 RenderProcessHost* rph = site_instance->GetProcess();
217 218
218 // This Init() call posts a task to the IO thread that adds the RPH's 219 // This Init() call posts a task to the IO thread that adds the RPH's
219 // ServiceWorkerDispatcherHost to the 220 // ServiceWorkerDispatcherHost to the
220 // EmbeddedWorkerRegistry::process_sender_map_. 221 // EmbeddedWorkerRegistry::process_sender_map_.
221 if (!rph->Init()) { 222 if (!rph->Init()) {
222 LOG(ERROR) << "Couldn't start a new process!"; 223 LOG(ERROR) << "Couldn't start a new process!";
223 BrowserThread::PostTask( 224 BrowserThread::PostTask(
224 BrowserThread::IO, FROM_HERE, 225 BrowserThread::IO, FROM_HERE,
225 base::Bind(callback, SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND, 226 base::Bind(callback, SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 namespace std { 335 namespace std {
335 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the 336 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the
336 // member WeakPtr to safely guard the object's lifetime when used on that 337 // member WeakPtr to safely guard the object's lifetime when used on that
337 // thread. 338 // thread.
338 void default_delete<content::ServiceWorkerProcessManager>::operator()( 339 void default_delete<content::ServiceWorkerProcessManager>::operator()(
339 content::ServiceWorkerProcessManager* ptr) const { 340 content::ServiceWorkerProcessManager* ptr) const {
340 content::BrowserThread::DeleteSoon( 341 content::BrowserThread::DeleteSoon(
341 content::BrowserThread::UI, FROM_HERE, ptr); 342 content::BrowserThread::UI, FROM_HERE, ptr);
342 } 343 }
343 } // namespace std 344 } // namespace std
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/site_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698