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

Issue 477593007: ServiceWorker: Make '.ready' return a promise to be resolved with ServiceWorkerRegistration (2/3) (Closed)

Created:
6 years, 4 months ago by nhiroki
Modified:
6 years, 3 months ago
Reviewers:
michaeln, nasko, horo
CC:
chromium-reviews, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, jam, kinuko+serviceworker, darin-cc_chromium.org, horo+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

ServiceWorker: Make '.ready' return a promise to be resolved with ServiceWorkerRegistration (2/3) Potential controllees need to observe version change events to make a ready registration, but, before this patch, those events are sent not to potential controllees but to pages that have the corresponding registration object (to be more precise, pages that have the reference to the registration). After this patch, ServiceWorkerProviderHost sends an IPC message to the corresponding ServiceWorkerProviderContext when the host gets associated with a registration and the provider context retains a reference of the registration so that the potential controllee can observe the version change events. 1) Blink: https://codereview.chromium.org/476043002/ 2) Chromium: THIS PATCH 3) Blink: https://codereview.chromium.org/532653002/ BUG=399533 TEST=content_unittests --gtest_filter=ServiceWorker* TEST=run_webkit_tests.py --debug http/tests/serviceworker/ (with the patch (3)) Committed: https://crrev.com/71840871e1f8499d843d6a21dee0e361c3ba64f0 Cr-Commit-Position: refs/heads/master@{#294147}

Patch Set 1 : #

Total comments: 10

Patch Set 2 : remake #

Patch Set 3 : remake more #

Total comments: 15

Patch Set 4 : address nasko@'s comments (unassociate -> dissociate) #

Patch Set 5 : revert the early call of AssociateRegistration() #

Patch Set 6 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+292 lines, -56 lines) Patch
M content/browser/service_worker/service_worker_controllee_request_handler.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M content/browser/service_worker/service_worker_provider_host.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M content/browser/service_worker/service_worker_provider_host.cc View 1 2 3 4 5 3 chunks +25 lines, -3 lines 0 comments Download
M content/browser/service_worker/service_worker_provider_host_unittest.cc View 1 2 3 4 5 6 chunks +8 lines, -8 lines 0 comments Download
M content/child/service_worker/service_worker_dispatcher.h View 1 2 3 4 3 chunks +22 lines, -6 lines 0 comments Download
M content/child/service_worker/service_worker_dispatcher.cc View 1 2 3 4 13 chunks +113 lines, -25 lines 0 comments Download
M content/child/service_worker/service_worker_provider_context.h View 1 2 3 4 5 chunks +19 lines, -4 lines 0 comments Download
M content/child/service_worker/service_worker_provider_context.cc View 1 2 3 4 4 chunks +65 lines, -8 lines 0 comments Download
M content/child/service_worker/service_worker_registration_handle_reference.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/child/service_worker/web_service_worker_provider_impl.cc View 1 2 2 chunks +26 lines, -0 lines 0 comments Download
M content/common/service_worker/service_worker_messages.h View 1 2 3 4 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (3 generated)
nhiroki
Ptal, thanks!
6 years, 3 months ago (2014-09-02 11:13:04 UTC) #2
nhiroki
Hmmm... I might have found a corner case of the association introduced by this CL. ...
6 years, 3 months ago (2014-09-02 15:52:01 UTC) #3
michaeln
i can't really reason about the renderer-side of this code :( but the changes to ...
6 years, 3 months ago (2014-09-04 00:27:23 UTC) #4
nhiroki
Remade the CL. Can you take another look? I tried to make it clearer that ...
6 years, 3 months ago (2014-09-08 15:55:52 UTC) #5
michaeln
https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc File content/browser/service_worker/service_worker_controllee_request_handler.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc#newcode142 content/browser/service_worker/service_worker_controllee_request_handler.cc:142: provider_host_->AssociateRegistration(registration.get()); On 2014/09/08 15:55:52, nhiroki wrote: > To associate ...
6 years, 3 months ago (2014-09-09 02:22:02 UTC) #6
nhiroki
Thank you for your comments. Reply only. https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc File content/browser/service_worker/service_worker_controllee_request_handler.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc#newcode142 content/browser/service_worker/service_worker_controllee_request_handler.cc:142: provider_host_->AssociateRegistration(registration.get()); On ...
6 years, 3 months ago (2014-09-09 08:49:08 UTC) #7
nhiroki
https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc File content/browser/service_worker/service_worker_controllee_request_handler.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc#newcode142 content/browser/service_worker/service_worker_controllee_request_handler.cc:142: provider_host_->AssociateRegistration(registration.get()); > > Are you concerned about the raciness ...
6 years, 3 months ago (2014-09-09 11:48:35 UTC) #8
michaeln
lgtm > As per the spec discussion > (https://github.com/slightlyoff/ServiceWorker/issues/357#issuecomment-53397325), > an active worker of the ...
6 years, 3 months ago (2014-09-09 23:30:25 UTC) #9
michaeln
https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc File content/browser/service_worker/service_worker_controllee_request_handler.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_controllee_request_handler.cc#newcode142 content/browser/service_worker/service_worker_controllee_request_handler.cc:142: provider_host_->AssociateRegistration(registration.get()); > Hmmm... I think the condition would have ...
6 years, 3 months ago (2014-09-09 23:30:33 UTC) #10
nhiroki
Thanks! I’ll commit this after reverting the early call (changes of ServiceWorkerControlleeRequestHandler) and addressing your ...
6 years, 3 months ago (2014-09-10 00:48:15 UTC) #11
nhiroki
+nasko@, please take a look at service_worker_messages.h. Thanks.
6 years, 3 months ago (2014-09-10 00:55:22 UTC) #13
nasko
Some comments. https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc File content/browser/service_worker/service_worker_provider_host.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc#newcode162 content/browser/service_worker/service_worker_provider_host.cc:162: kDocumentMainThreadId, provider_id(), handle->GetObjectInfo(), attrs)); nit: Is this ...
6 years, 3 months ago (2014-09-10 01:15:56 UTC) #14
nhiroki
nasko@: Thank you for reviewing. Can you take another look? https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc File content/browser/service_worker/service_worker_provider_host.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc#newcode162 ...
6 years, 3 months ago (2014-09-10 01:50:47 UTC) #15
nasko
LGTM I just realized that "disassociate" is probably more common, but feel free to leave ...
6 years, 3 months ago (2014-09-10 04:15:10 UTC) #16
nhiroki
https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc File content/browser/service_worker/service_worker_provider_host.cc (right): https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc#newcode162 content/browser/service_worker/service_worker_provider_host.cc:162: kDocumentMainThreadId, provider_id(), handle->GetObjectInfo(), attrs)); On 2014/09/10 04:15:10, nasko wrote: ...
6 years, 3 months ago (2014-09-10 05:28:47 UTC) #17
nasko
On 2014/09/10 05:28:47, nhiroki wrote: > https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc > File content/browser/service_worker/service_worker_provider_host.cc (right): > > https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc#newcode162 > ...
6 years, 3 months ago (2014-09-10 05:33:56 UTC) #18
nhiroki
On 2014/09/10 05:33:56, nasko wrote: > On 2014/09/10 05:28:47, nhiroki wrote: > > > https://codereview.chromium.org/477593007/diff/460001/content/browser/service_worker/service_worker_provider_host.cc ...
6 years, 3 months ago (2014-09-10 05:47:37 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nhiroki@chromium.org/477593007/520001
6 years, 3 months ago (2014-09-10 08:06:36 UTC) #21
commit-bot: I haz the power
Committed patchset #6 (id:520001) as f42eac9167b0b69fee2bcb26ac889e940d8e327c
6 years, 3 months ago (2014-09-10 09:01:26 UTC) #22
commit-bot: I haz the power
6 years, 3 months ago (2014-09-10 10:56:13 UTC) #23
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/71840871e1f8499d843d6a21dee0e361c3ba64f0
Cr-Commit-Position: refs/heads/master@{#294147}

Powered by Google App Engine
This is Rietveld 408576698