| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 ServiceWorkerProcessManager::~ServiceWorkerProcessManager() { | 57 ServiceWorkerProcessManager::~ServiceWorkerProcessManager() { |
| 58 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 58 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 59 DCHECK(browser_context_ == NULL) | 59 DCHECK(browser_context_ == NULL) |
| 60 << "Call Shutdown() before destroying |this|, so that racing method " | 60 << "Call Shutdown() before destroying |this|, so that racing method " |
| 61 << "invocations don't use a destroyed BrowserContext."; | 61 << "invocations don't use a destroyed BrowserContext."; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ServiceWorkerProcessManager::Shutdown() { | 64 void ServiceWorkerProcessManager::Shutdown() { |
| 65 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 65 browser_context_ = NULL; | 66 browser_context_ = NULL; |
| 66 for (std::map<int, ProcessInfo>::const_iterator it = instance_info_.begin(); | 67 for (std::map<int, ProcessInfo>::const_iterator it = instance_info_.begin(); |
| 67 it != instance_info_.end(); | 68 it != instance_info_.end(); |
| 68 ++it) { | 69 ++it) { |
| 69 RenderProcessHost* rph = RenderProcessHost::FromID(it->second.process_id); | 70 RenderProcessHost* rph = RenderProcessHost::FromID(it->second.process_id); |
| 70 DCHECK(rph); | 71 DCHECK(rph); |
| 71 static_cast<RenderProcessHostImpl*>(rph)->DecrementWorkerRefCount(); | 72 static_cast<RenderProcessHostImpl*>(rph)->DecrementWorkerRefCount(); |
| 72 } | 73 } |
| 73 instance_info_.clear(); | 74 instance_info_.clear(); |
| 74 } | 75 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 namespace base { | 271 namespace base { |
| 271 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the | 272 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the |
| 272 // member WeakPtr to safely guard the object's lifetime when used on that | 273 // member WeakPtr to safely guard the object's lifetime when used on that |
| 273 // thread. | 274 // thread. |
| 274 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( | 275 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( |
| 275 content::ServiceWorkerProcessManager* ptr) const { | 276 content::ServiceWorkerProcessManager* ptr) const { |
| 276 content::BrowserThread::DeleteSoon( | 277 content::BrowserThread::DeleteSoon( |
| 277 content::BrowserThread::UI, FROM_HERE, ptr); | 278 content::BrowserThread::UI, FROM_HERE, ptr); |
| 278 } | 279 } |
| 279 } // namespace base | 280 } // namespace base |
| OLD | NEW |