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

Issue 653633004: Shutdown Service Workers before the profile is destroyed (Closed)

Created:
6 years, 2 months ago by falken
Modified:
6 years, 1 month ago
CC:
chromium-reviews, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, kinuko+serviceworker, nhiroki, darin-cc_chromium.org, horo+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/41f417516ab894faa1ebfe33cd6197cb072f1bf7 Cr-Commit-Position: refs/heads/master@{#301800}

Patch Set 1 #

Total comments: 7

Patch Set 2 : MaybeSendNotification #

Patch Set 3 : ios build fix #

Total comments: 4

Patch Set 4 : sync #

Patch Set 5 : review comments #

Total comments: 2

Patch Set 6 : sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -28 lines) Patch
M chrome/browser/browser_process_impl.cc View 1 2 3 4 5 2 chunks +0 lines, -12 lines 0 comments Download
M chrome/browser/chrome_service_worker_browsertest.cc View 3 chunks +38 lines, -1 line 0 comments Download
M chrome/browser/profiles/profile.cc View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/browser_context.cc View 1 2 3 4 2 chunks +16 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_context_wrapper.h View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/service_worker/service_worker_context_wrapper.cc View 1 2 3 4 1 chunk +0 lines, -5 lines 0 comments Download
M content/browser/service_worker/service_worker_process_manager.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/service_worker/service_worker_process_manager.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/browser_context.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M content/public/browser/service_worker_context.h View 1 2 3 4 2 chunks +1 line, -7 lines 0 comments Download

Messages

Total messages: 20 (4 generated)
falken
This is a bit WIP still, see comments inline. I have a fix in ExtensionService ...
6 years, 2 months ago (2014-10-21 09:36:36 UTC) #2
michaeln
fyi: I think normal partitions are never deleted till the end due to the problems ...
6 years, 2 months ago (2014-10-21 23:24:14 UTC) #3
michaeln
> I have a fix in ExtensionService that seems to work, just replaced the > ...
6 years, 2 months ago (2014-10-21 23:43:03 UTC) #4
falken
Thanks for the comments: >> I have a fix in ExtensionService that seems to work, ...
6 years, 2 months ago (2014-10-22 01:27:12 UTC) #5
falken
I changed the patch to hook into MaybeSendDestroyedNotification as michaeln suggested. jam: please review as ...
6 years, 2 months ago (2014-10-22 05:23:23 UTC) #8
michaeln
jam should take a look at the public api changes https://codereview.chromium.org/653633004/diff/60001/content/public/browser/browser_context.h File content/public/browser/browser_context.h (right): https://codereview.chromium.org/653633004/diff/60001/content/public/browser/browser_context.h#newcode169 ...
6 years, 2 months ago (2014-10-22 22:52:46 UTC) #9
falken
Thanks, PTAL. https://codereview.chromium.org/653633004/diff/60001/content/public/browser/browser_context.h File content/public/browser/browser_context.h (right): https://codereview.chromium.org/653633004/diff/60001/content/public/browser/browser_context.h#newcode169 content/public/browser/browser_context.h:169: void NotifyWillBeDestroyed(); On 2014/10/22 22:52:46, michaeln wrote: ...
6 years, 2 months ago (2014-10-23 02:06:38 UTC) #10
jam
https://codereview.chromium.org/653633004/diff/100001/chrome/browser/profiles/profile.cc File chrome/browser/profiles/profile.cc (right): https://codereview.chromium.org/653633004/diff/100001/chrome/browser/profiles/profile.cc#newcode256 chrome/browser/profiles/profile.cc:256: NotifyWillBeDestroyed(this); we shouldn't have content depend on every embedder ...
6 years, 2 months ago (2014-10-23 22:45:22 UTC) #11
michaeln
i think the proposed change is an improvement over the existing code, so from that ...
6 years, 2 months ago (2014-10-24 00:45:26 UTC) #12
falken
https://codereview.chromium.org/653633004/diff/100001/chrome/browser/profiles/profile.cc File chrome/browser/profiles/profile.cc (right): https://codereview.chromium.org/653633004/diff/100001/chrome/browser/profiles/profile.cc#newcode256 chrome/browser/profiles/profile.cc:256: NotifyWillBeDestroyed(this); On 2014/10/23 22:45:22, jam wrote: > we shouldn't ...
6 years, 2 months ago (2014-10-24 00:53:34 UTC) #13
falken
jam: ping This seems like an improvement of existing code, although it still relies on ...
6 years, 1 month ago (2014-10-28 13:14:41 UTC) #14
jam
lgtm for now to fix this problem. i don't have time to look into this ...
6 years, 1 month ago (2014-10-29 05:12:16 UTC) #15
falken
Thanks for the review. On 2014/10/29 05:12:16, jam wrote: > > It's actually chrome stuff ...
6 years, 1 month ago (2014-10-29 05:30:31 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/653633004/120001
6 years, 1 month ago (2014-10-29 05:31:03 UTC) #18
commit-bot: I haz the power
Committed patchset #6 (id:120001)
6 years, 1 month ago (2014-10-29 07:03:49 UTC) #19
commit-bot: I haz the power
6 years, 1 month ago (2014-10-29 07:04:28 UTC) #20
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/41f417516ab894faa1ebfe33cd6197cb072f1bf7
Cr-Commit-Position: refs/heads/master@{#301800}

Powered by Google App Engine
This is Rietveld 408576698