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

Issue 473743002: ServiceWorker: register() should return the existing registration object if available (Closed)

Created:
6 years, 4 months ago by nhiroki
Modified:
6 years, 4 months ago
Reviewers:
falken, tkent, sof
CC:
blink-reviews, michaeln, jsbell+serviceworker_chromium.org, jamesr, tzik, serviceworker-reviews, abarth-chromium, falken, dglazkov+blink, kinuko+serviceworker, horo+watch_chromium.org, oilpan-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

ServiceWorker: register() should return the existing registration object if available Before this patch, register() always returns new registration object even if the same registration already exists. This patch makes register() return the existing object if it's available. Chromium-side change: https://codereview.chromium.org/470843002/ NOTE: ServiceWorkerRegistration is still disabled and this change does not affect the existing code/behavior. BUG=396400 TEST=https://codereview.chromium.org/466723002/ NOTRY=true Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=180251

Patch Set 1 #

Patch Set 2 : add missing file #

Total comments: 4

Patch Set 3 : review fix #

Patch Set 4 : fix #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -4 lines) Patch
M Source/modules/serviceworkers/ServiceWorkerRegistration.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerRegistration.cpp View 1 2 3 3 chunks +15 lines, -2 lines 0 comments Download
M Source/platform/blink_platform.gypi View 1 chunk +1 line, -0 lines 0 comments Download
A Source/platform/exported/WebServiceWorkerRegistrationProxy.cpp View 1 2 1 chunk +20 lines, -0 lines 0 comments Download
M public/platform/WebServiceWorkerRegistration.h View 1 chunk +2 lines, -0 lines 0 comments Download
M public/platform/WebServiceWorkerRegistrationProxy.h View 1 2 3 chunks +12 lines, -1 line 2 comments Download

Messages

Total messages: 17 (0 generated)
nhiroki
Hi falken@, can you review this? Thanks!
6 years, 4 months ago (2014-08-14 04:33:26 UTC) #1
nhiroki
On 2014/08/14 04:33:26, nhiroki wrote: > Hi falken@, can you review this? Thanks! Added a ...
6 years, 4 months ago (2014-08-14 04:36:02 UTC) #2
falken
lgtm nit: "has been existed" -> "already exists"
6 years, 4 months ago (2014-08-14 05:04:35 UTC) #3
nhiroki
On 2014/08/14 05:04:35, falken wrote: > lgtm > > nit: "has been existed" -> "already ...
6 years, 4 months ago (2014-08-14 05:17:05 UTC) #4
nhiroki
6 years, 4 months ago (2014-08-14 05:18:17 UTC) #5
nhiroki
tkent@: Can you review {Source,public}/platform/*? Thanks!
6 years, 4 months ago (2014-08-14 05:19:16 UTC) #6
tkent
https://codereview.chromium.org/473743002/diff/20001/public/platform/WebServiceWorkerRegistrationProxy.h File public/platform/WebServiceWorkerRegistrationProxy.h (right): https://codereview.chromium.org/473743002/diff/20001/public/platform/WebServiceWorkerRegistrationProxy.h#newcode8 public/platform/WebServiceWorkerRegistrationProxy.h:8: #include "WebCommon.h" should be "public/platform/WebCommon.h" https://codereview.chromium.org/473743002/diff/20001/public/platform/WebServiceWorkerRegistrationProxy.h#newcode34 public/platform/WebServiceWorkerRegistrationProxy.h:34: BLINK_PLATFORM_EXPORT ServiceWorkerRegistration* ...
6 years, 4 months ago (2014-08-14 05:33:15 UTC) #7
nhiroki
Thanks! Updated. https://codereview.chromium.org/473743002/diff/20001/public/platform/WebServiceWorkerRegistrationProxy.h File public/platform/WebServiceWorkerRegistrationProxy.h (right): https://codereview.chromium.org/473743002/diff/20001/public/platform/WebServiceWorkerRegistrationProxy.h#newcode8 public/platform/WebServiceWorkerRegistrationProxy.h:8: #include "WebCommon.h" On 2014/08/14 05:33:15, tkent wrote: ...
6 years, 4 months ago (2014-08-14 06:15:19 UTC) #8
tkent
lgtm
6 years, 4 months ago (2014-08-14 06:28:03 UTC) #9
nhiroki
The CQ bit was checked by nhiroki@chromium.org
6 years, 4 months ago (2014-08-14 06:44:59 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nhiroki@chromium.org/473743002/60001
6 years, 4 months ago (2014-08-14 06:45:32 UTC) #11
nhiroki
The CQ bit was unchecked by nhiroki@chromium.org
6 years, 4 months ago (2014-08-14 08:52:08 UTC) #12
nhiroki
The CQ bit was checked by nhiroki@chromium.org
6 years, 4 months ago (2014-08-14 08:52:20 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nhiroki@chromium.org/473743002/60001
6 years, 4 months ago (2014-08-14 08:53:46 UTC) #14
commit-bot: I haz the power
Committed patchset #4 (60001) as 180251
6 years, 4 months ago (2014-08-14 08:55:21 UTC) #15
sof
https://codereview.chromium.org/473743002/diff/60001/public/platform/WebServiceWorkerRegistrationProxy.h File public/platform/WebServiceWorkerRegistrationProxy.h (right): https://codereview.chromium.org/473743002/diff/60001/public/platform/WebServiceWorkerRegistrationProxy.h#newcode38 public/platform/WebServiceWorkerRegistrationProxy.h:38: ServiceWorkerRegistration* m_private; This is a GCed object; can you ...
6 years, 4 months ago (2014-08-14 08:59:49 UTC) #16
nhiroki
6 years, 4 months ago (2014-08-15 00:05:54 UTC) #17
Message was sent while issue was closed.
https://codereview.chromium.org/473743002/diff/60001/public/platform/WebServi...
File public/platform/WebServiceWorkerRegistrationProxy.h (right):

https://codereview.chromium.org/473743002/diff/60001/public/platform/WebServi...
public/platform/WebServiceWorkerRegistrationProxy.h:38:
ServiceWorkerRegistration* m_private;
On 2014/08/14 08:59:49, sof wrote:
> This is a GCed object; can you guarantee that the object is otherwise
referenced
> and kept alive for the duration of this proxy object?
> 
> (I guess what I'm really asking is why this isn't wrapped in a
WebPrivatePtr<>.)

Thank you for pointing out! I think our subsequent CLs will ensure that the
proxy is never accessed after it stops, and I'll consider the WebPrivatePtr<>
way (sorry, I don't really understand that pointer yet).


Following lists are just my memo about the lifetime of the proxy object:

1) ServiceWorkerRegistration is not GCed until ServiceWorkerRegistration::stop()
is called (see https://codereview.chromium.org/467133002/).
2) After the registration is stoped, |m_private| is no longer accessed
(CallbackPromiseAdapter doesn't call ServiceWorkerRegistration::take()).
3) When the proxy stops, the embedder is notified via
WebServiceWorkerRegistration::proxyStopped() and stops using the proxy object
(I'm making the chromium-side CL for this).

Powered by Google App Engine
This is Rietveld 408576698