| Index: content/browser/browser_context.cc
|
| diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
|
| index 064b2097fd8a9a744a23ca8076ec88f3a39fd68d..a0ca8ce5a936f47b1a99676ad0c90e148d0a261c 100644
|
| --- a/content/browser/browser_context.cc
|
| +++ b/content/browser/browser_context.cc
|
| @@ -84,6 +84,10 @@ void SaveSessionStateOnIndexedDBThread(
|
| indexed_db_context->SetForceKeepSessionState();
|
| }
|
|
|
| +void ShutdownServiceWorkerContext(StoragePartition* partition) {
|
| + partition->GetServiceWorkerContext()->Terminate();
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -270,6 +274,13 @@ void BrowserContext::SaveSessionState(BrowserContext* browser_context) {
|
| }
|
| }
|
|
|
| +void BrowserContext::NotifyWillBeDestroyed() {
|
| + // 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(this, base::Bind(ShutdownServiceWorkerContext));
|
| +}
|
| +
|
| #endif // !OS_IOS
|
|
|
| BrowserContext::~BrowserContext() {
|
|
|