Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (static_cast<RenderProcessHostImpl*>(rph)->backgrounded()) | |
|
kinuko
2015/09/30 09:26:15
nit: could we add a comment (like what you wrote i
horo
2015/09/30 09:45:37
Done.
| |
| 32 return false; | |
| 31 | 33 |
| 32 static_cast<RenderProcessHostImpl*>(rph)->IncrementWorkerRefCount(); | 34 static_cast<RenderProcessHostImpl*>(rph)->IncrementWorkerRefCount(); |
| 33 return true; | 35 return true; |
| 34 } | 36 } |
| 35 | 37 |
| 36 ServiceWorkerProcessManager::ProcessInfo::ProcessInfo( | 38 ServiceWorkerProcessManager::ProcessInfo::ProcessInfo( |
| 37 const scoped_refptr<SiteInstance>& site_instance) | 39 const scoped_refptr<SiteInstance>& site_instance) |
| 38 : site_instance(site_instance), | 40 : site_instance(site_instance), |
| 39 process_id(site_instance->GetProcess()->GetID()) { | 41 process_id(site_instance->GetProcess()->GetID()) { |
| 40 } | 42 } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 namespace base { | 272 namespace base { |
| 271 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the | 273 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the |
| 272 // member WeakPtr to safely guard the object's lifetime when used on that | 274 // member WeakPtr to safely guard the object's lifetime when used on that |
| 273 // thread. | 275 // thread. |
| 274 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( | 276 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( |
| 275 content::ServiceWorkerProcessManager* ptr) const { | 277 content::ServiceWorkerProcessManager* ptr) const { |
| 276 content::BrowserThread::DeleteSoon( | 278 content::BrowserThread::DeleteSoon( |
| 277 content::BrowserThread::UI, FROM_HERE, ptr); | 279 content::BrowserThread::UI, FROM_HERE, ptr); |
| 278 } | 280 } |
| 279 } // namespace base | 281 } // namespace base |
| OLD | NEW |