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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 CHECK(instance_info_.empty()); | 70 CHECK(instance_info_.empty()); |
71 } | 71 } |
72 | 72 |
73 void ServiceWorkerProcessManager::Shutdown() { | 73 void ServiceWorkerProcessManager::Shutdown() { |
74 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 74 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
75 { | 75 { |
76 base::AutoLock lock(browser_context_lock_); | 76 base::AutoLock lock(browser_context_lock_); |
77 browser_context_ = nullptr; | 77 browser_context_ = nullptr; |
78 } | 78 } |
79 | 79 |
80 for (std::map<int, ProcessInfo>::const_iterator it = instance_info_.begin(); | 80 if (!RenderProcessHost::run_renderer_in_process()) { |
nhiroki
2017/04/17 23:26:21
Could you add a comment about why we need to skip
| |
81 it != instance_info_.end(); | 81 for (std::map<int, ProcessInfo>::const_iterator it = instance_info_.begin(); |
82 ++it) { | 82 it != instance_info_.end(); ++it) { |
83 RenderProcessHost::FromID(it->second.process_id) | 83 RenderProcessHost::FromID(it->second.process_id) |
84 ->DecrementServiceWorkerRefCount(); | 84 ->DecrementServiceWorkerRefCount(); |
85 } | |
85 } | 86 } |
86 instance_info_.clear(); | 87 instance_info_.clear(); |
87 } | 88 } |
88 | 89 |
89 bool ServiceWorkerProcessManager::IsShutdown() { | 90 bool ServiceWorkerProcessManager::IsShutdown() { |
90 base::AutoLock lock(browser_context_lock_); | 91 base::AutoLock lock(browser_context_lock_); |
91 return !browser_context_; | 92 return !browser_context_; |
92 } | 93 } |
93 | 94 |
94 void ServiceWorkerProcessManager::AddProcessReferenceToPattern( | 95 void ServiceWorkerProcessManager::AddProcessReferenceToPattern( |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |