Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: content/browser/browser_context.cc

Issue 653633004: Shutdown Service Workers before the profile is destroyed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios build fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698