| Index: content/browser/browser_context.cc
|
| diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
|
| index 064b2097fd8a9a744a23ca8076ec88f3a39fd68d..5557719408c4745e4f880157c28e1a151e483f64 100644
|
| --- a/content/browser/browser_context.cc
|
| +++ b/content/browser/browser_context.cc
|
| @@ -84,6 +84,13 @@ void SaveSessionStateOnIndexedDBThread(
|
| indexed_db_context->SetForceKeepSessionState();
|
| }
|
|
|
| +void ShutdownServiceWorkerContext(StoragePartition* partition) {
|
| + ServiceWorkerContextWrapper* wrapper =
|
| + static_cast<ServiceWorkerContextWrapper*>(
|
| + partition->GetServiceWorkerContext());
|
| + wrapper->process_manager()->Shutdown();
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -225,6 +232,15 @@ void BrowserContext::DeliverPushMessage(
|
| browser_context, origin, service_worker_registration_id, data, callback);
|
| }
|
|
|
| +// static
|
| +void BrowserContext::NotifyWillBeDestroyed(BrowserContext* browser_context) {
|
| + // Service Workers must shutdown before the browser context is destroyed,
|
| + // since they keep render process hosts alive and the codebase assumes that
|
| + // render process hosts die before their profile (browser context) dies.
|
| + ForEachStoragePartition(browser_context,
|
| + base::Bind(ShutdownServiceWorkerContext));
|
| +}
|
| +
|
| void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) {
|
| // This will be enough to tickle initialization of BrowserContext if
|
| // necessary, which initializes ResourceContext. The reason we don't call
|
|
|