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

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

Issue 1373853003: Don't choose a background process when choosing a process for starting a Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 5 years, 2 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
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/render_process_host_impl.h" 7 #include "content/browser/renderer_host/render_process_host_impl.h"
8 #include "content/browser/service_worker/service_worker_context_wrapper.h" 8 #include "content/browser/service_worker/service_worker_context_wrapper.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/site_instance.h" 10 #include "content/public/browser/site_instance.h"
(...skipping 10 matching lines...) Expand all
21 return lhs.second > rhs.second; 21 return lhs.second > rhs.second;
22 } 22 }
23 }; 23 };
24 24
25 } // namespace 25 } // namespace
26 26
27 static bool IncrementWorkerRefCountByPid(int process_id) { 27 static bool IncrementWorkerRefCountByPid(int process_id) {
28 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); 28 RenderProcessHost* rph = RenderProcessHost::FromID(process_id);
29 if (!rph || rph->FastShutdownStarted()) 29 if (!rph || rph->FastShutdownStarted())
30 return false; 30 return false;
31 // TODO(horo): This is a quick fix for crbug.com/531345. We need to revisit
32 // the behavior of ServiceWorker and the timer suspension of background
33 // processes which was intoruced by crrev.com/1133143003.
34 if (static_cast<RenderProcessHostImpl*>(rph)->backgrounded())
35 return false;
31 36
32 static_cast<RenderProcessHostImpl*>(rph)->IncrementWorkerRefCount(); 37 static_cast<RenderProcessHostImpl*>(rph)->IncrementWorkerRefCount();
33 return true; 38 return true;
34 } 39 }
35 40
36 ServiceWorkerProcessManager::ProcessInfo::ProcessInfo( 41 ServiceWorkerProcessManager::ProcessInfo::ProcessInfo(
37 const scoped_refptr<SiteInstance>& site_instance) 42 const scoped_refptr<SiteInstance>& site_instance)
38 : site_instance(site_instance), 43 : site_instance(site_instance),
39 process_id(site_instance->GetProcess()->GetID()) { 44 process_id(site_instance->GetProcess()->GetID()) {
40 } 45 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 namespace base { 275 namespace base {
271 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the 276 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the
272 // member WeakPtr to safely guard the object's lifetime when used on that 277 // member WeakPtr to safely guard the object's lifetime when used on that
273 // thread. 278 // thread.
274 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( 279 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()(
275 content::ServiceWorkerProcessManager* ptr) const { 280 content::ServiceWorkerProcessManager* ptr) const {
276 content::BrowserThread::DeleteSoon( 281 content::BrowserThread::DeleteSoon(
277 content::BrowserThread::UI, FROM_HERE, ptr); 282 content::BrowserThread::UI, FROM_HERE, ptr);
278 } 283 }
279 } // namespace base 284 } // namespace base
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698