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

Issue 330173003: Make ServiceWorker an ActiveDOMObject (Closed)

Created:
6 years, 6 months ago by falken
Modified:
6 years, 6 months ago
CC:
blink-reviews, michaeln, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, nhiroki, falken, kinuko+serviceworker, horo+watch_chromium.org, alecflett+watch_chromium.org
Project:
blink
Visibility:
Public.

Description

Make ServiceWorker an ActiveDOMObject Before this patch, the ServiceWorker object returned by navigator.serviceWorker.register() could be garbage collected prematurely causing state change event handlers to never be invoked. This patch makes ServiceWorker an ActiveDOMObject and keeps it alive until either stop() is called on it (indicating detach of the parent document) or it reaches the terminal "deactivated" state (soon to be renamed "redundant"). For future work, it may be possible to be more clever and allow the SW to die when it has no event handlers. BUG=383972 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176197

Patch Set 1 #

Patch Set 2 : fix hasPendingActivity #

Total comments: 13

Patch Set 3 : review comments #

Total comments: 12

Patch Set 4 : call up to AbstractWorker::hasPendingActivity #

Patch Set 5 : revise test #

Total comments: 11

Patch Set 6 : review comments #

Total comments: 2

Patch Set 7 : patch for landing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -12 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 1 chunk +0 lines, -2 lines 0 comments Download
M LayoutTests/http/tests/serviceworker/fetch-event.html View 1 chunk +1 line, -1 line 0 comments Download
A LayoutTests/http/tests/serviceworker/service-worker-gc.html View 1 2 3 4 5 6 1 chunk +58 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/service-worker-gc-expected.txt View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/virtual/serviceworker/http/tests/serviceworker/service-worker-gc-expected.txt View 1 2 3 4 5 1 chunk +15 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.h View 1 2 1 chunk +13 lines, -1 line 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.cpp View 1 2 3 3 chunks +45 lines, -8 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.idl View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
falken
PTAL
6 years, 6 months ago (2014-06-12 21:06:11 UTC) #1
dominicc (has gone to gerrit)
https://codereview.chromium.org/330173003/diff/20001/LayoutTests/http/tests/serviceworker/service-worker-gc.html File LayoutTests/http/tests/serviceworker/service-worker-gc.html (right): https://codereview.chromium.org/330173003/diff/20001/LayoutTests/http/tests/serviceworker/service-worker-gc.html#newcode2 LayoutTests/http/tests/serviceworker/service-worker-gc.html:2: <script src="../resources/testharness.js"></script> This should use the Blink test harness. ...
6 years, 6 months ago (2014-06-12 22:23:39 UTC) #2
falken
Thanks, PTAL https://codereview.chromium.org/330173003/diff/20001/LayoutTests/http/tests/serviceworker/service-worker-gc.html File LayoutTests/http/tests/serviceworker/service-worker-gc.html (right): https://codereview.chromium.org/330173003/diff/20001/LayoutTests/http/tests/serviceworker/service-worker-gc.html#newcode2 LayoutTests/http/tests/serviceworker/service-worker-gc.html:2: <script src="../resources/testharness.js"></script> On 2014/06/12 22:23:38, dominicc wrote: ...
6 years, 6 months ago (2014-06-13 19:22:59 UTC) #3
falken
I added a call up to AbstractWorker::hasPendingActivity. I'm not sure whether we want it to ...
6 years, 6 months ago (2014-06-13 19:40:36 UTC) #4
dominicc (has gone to gerrit)
I think the proxy state thing is very neat; some comments and questions about the ...
6 years, 6 months ago (2014-06-13 19:55:13 UTC) #5
falken
Thanks, I changed the test a bit. It turns out there is a race between ...
6 years, 6 months ago (2014-06-13 22:34:19 UTC) #6
dominicc (has gone to gerrit)
More comments on the test. https://codereview.chromium.org/330173003/diff/80001/LayoutTests/http/tests/serviceworker/service-worker-gc.html File LayoutTests/http/tests/serviceworker/service-worker-gc.html (right): https://codereview.chromium.org/330173003/diff/80001/LayoutTests/http/tests/serviceworker/service-worker-gc.html#newcode5 LayoutTests/http/tests/serviceworker/service-worker-gc.html:5: (function() { I think ...
6 years, 6 months ago (2014-06-14 20:02:47 UTC) #7
falken
Revised the test, how is this? https://codereview.chromium.org/330173003/diff/80001/LayoutTests/http/tests/serviceworker/service-worker-gc.html File LayoutTests/http/tests/serviceworker/service-worker-gc.html (right): https://codereview.chromium.org/330173003/diff/80001/LayoutTests/http/tests/serviceworker/service-worker-gc.html#newcode5 LayoutTests/http/tests/serviceworker/service-worker-gc.html:5: (function() { On ...
6 years, 6 months ago (2014-06-16 00:58:57 UTC) #8
dominicc (has gone to gerrit)
LGTM https://codereview.chromium.org/330173003/diff/100001/LayoutTests/http/tests/serviceworker/service-worker-gc.html File LayoutTests/http/tests/serviceworker/service-worker-gc.html (right): https://codereview.chromium.org/330173003/diff/100001/LayoutTests/http/tests/serviceworker/service-worker-gc.html#newcode43 LayoutTests/http/tests/serviceworker/service-worker-gc.html:43: gc(); Maybe just call assertServiceWorkerIsNotCollected since that fun ...
6 years, 6 months ago (2014-06-16 05:00:23 UTC) #9
falken
Thanks https://codereview.chromium.org/330173003/diff/100001/LayoutTests/http/tests/serviceworker/service-worker-gc.html File LayoutTests/http/tests/serviceworker/service-worker-gc.html (right): https://codereview.chromium.org/330173003/diff/100001/LayoutTests/http/tests/serviceworker/service-worker-gc.html#newcode43 LayoutTests/http/tests/serviceworker/service-worker-gc.html:43: gc(); On 2014/06/16 05:00:23, dominicc wrote: > Maybe ...
6 years, 6 months ago (2014-06-16 08:29:21 UTC) #10
falken
The CQ bit was checked by falken@chromium.org
6 years, 6 months ago (2014-06-16 08:29:32 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/falken@chromium.org/330173003/120001
6 years, 6 months ago (2014-06-16 08:30:39 UTC) #12
commit-bot: I haz the power
6 years, 6 months ago (2014-06-16 10:11:28 UTC) #13
Message was sent while issue was closed.
Change committed as 176197

Powered by Google App Engine
This is Rietveld 408576698