summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_process_impl.cc
diff options
context:
space:
mode:
authorfalken <falken@chromium.org>2014-10-29 00:03:41 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-29 07:03:56 +0000
commit41f417516ab894faa1ebfe33cd6197cb072f1bf7 (patch)
treeb644684a87b6bbba18cebc5c1bae238d4cc023d2 /chrome/browser/browser_process_impl.cc
parent8b00af9164418bd87937cfe0875b36e2b25e0f6c (diff)
downloadchromium_src-41f417516ab894faa1ebfe33cd6197cb072f1bf7.zip
chromium_src-41f417516ab894faa1ebfe33cd6197cb072f1bf7.tar.gz
chromium_src-41f417516ab894faa1ebfe33cd6197cb072f1bf7.tar.bz2
Shutdown Service Workers before the profile is destroyed
This fixes a crash when closing an incognito browser window that used Service Workers. Service Workers keep render process hosts alive. Service Workers are shutdown during the destruction of a profile (in ~StoragePartitionImpl). If the shutdown causes render process hosts to die, ExtensionService (and possibly other clients) receive a NOTIFICATION_RENDERER_PROCESS_TERMINATED and try to access the half-destroyed profile, causing a crash. We don't see this in a non-incognito window since the main profile is not destroyed until after browser shutdown, and we had special code to shutdown Service Workers there. This patch changes the special Service Worker shutdown code to happen before a profile is destroyed. BUG=419290 Review URL: https://codereview.chromium.org/653633004 Cr-Commit-Position: refs/heads/master@{#301800}
Diffstat (limited to 'chrome/browser/browser_process_impl.cc')
-rw-r--r--chrome/browser/browser_process_impl.cc12
1 files changed, 0 insertions, 12 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 47f44d7..0bb579e 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -349,10 +349,6 @@ unsigned int BrowserProcessImpl::AddRefModule() {
return module_ref_count_;
}
-static void ShutdownServiceWorkerContext(content::StoragePartition* partition) {
- partition->GetServiceWorkerContext()->Terminate();
-}
-
unsigned int BrowserProcessImpl::ReleaseModule() {
DCHECK(CalledOnValidThread());
DCHECK_NE(0u, module_ref_count_);
@@ -360,14 +356,6 @@ unsigned int BrowserProcessImpl::ReleaseModule() {
if (0 == module_ref_count_) {
release_last_reference_callstack_ = base::debug::StackTrace();
- // Stop service workers
- ProfileManager* pm = profile_manager();
- std::vector<Profile*> profiles(pm->GetLoadedProfiles());
- for (size_t i = 0; i < profiles.size(); ++i) {
- content::BrowserContext::ForEachStoragePartition(
- profiles[i], base::Bind(ShutdownServiceWorkerContext));
- }
-
#if defined(ENABLE_PRINTING)
// Wait for the pending print jobs to finish. Don't do this later, since
// this might cause a nested message loop to run, and we don't want pending