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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 weak_this_factory_(this) { | 57 weak_this_factory_(this) { |
58 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 58 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
59 weak_this_ = weak_this_factory_.GetWeakPtr(); | 59 weak_this_ = weak_this_factory_.GetWeakPtr(); |
60 } | 60 } |
61 | 61 |
62 ServiceWorkerProcessManager::~ServiceWorkerProcessManager() { | 62 ServiceWorkerProcessManager::~ServiceWorkerProcessManager() { |
63 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
64 DCHECK(IsShutdown()) | 64 DCHECK(IsShutdown()) |
65 << "Call Shutdown() before destroying |this|, so that racing method " | 65 << "Call Shutdown() before destroying |this|, so that racing method " |
66 << "invocations don't use a destroyed BrowserContext."; | 66 << "invocations don't use a destroyed BrowserContext."; |
67 DCHECK(instance_info_.empty()); | 67 // TODO(horo): Remove after collecting crash data. |
| 68 // Temporary checks to verify that ServiceWorkerProcessManager doesn't prevent |
| 69 // render process hosts from shutting down: crbug.com/639193 |
| 70 CHECK(instance_info_.empty()); |
68 } | 71 } |
69 | 72 |
70 void ServiceWorkerProcessManager::Shutdown() { | 73 void ServiceWorkerProcessManager::Shutdown() { |
71 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 74 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
72 { | 75 { |
73 base::AutoLock lock(browser_context_lock_); | 76 base::AutoLock lock(browser_context_lock_); |
74 browser_context_ = nullptr; | 77 browser_context_ = nullptr; |
75 } | 78 } |
76 | 79 |
77 for (std::map<int, ProcessInfo>::const_iterator it = instance_info_.begin(); | 80 for (std::map<int, ProcessInfo>::const_iterator it = instance_info_.begin(); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 namespace std { | 333 namespace std { |
331 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the | 334 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the |
332 // member WeakPtr to safely guard the object's lifetime when used on that | 335 // member WeakPtr to safely guard the object's lifetime when used on that |
333 // thread. | 336 // thread. |
334 void default_delete<content::ServiceWorkerProcessManager>::operator()( | 337 void default_delete<content::ServiceWorkerProcessManager>::operator()( |
335 content::ServiceWorkerProcessManager* ptr) const { | 338 content::ServiceWorkerProcessManager* ptr) const { |
336 content::BrowserThread::DeleteSoon( | 339 content::BrowserThread::DeleteSoon( |
337 content::BrowserThread::UI, FROM_HERE, ptr); | 340 content::BrowserThread::UI, FROM_HERE, ptr); |
338 } | 341 } |
339 } // namespace std | 342 } // namespace std |
OLD | NEW |