|
|
Created:
6 years, 5 months ago by sof Modified:
6 years, 5 months ago CC:
blink-reviews, michaeln, jsbell+serviceworker_chromium.org, arv+blink, tzik, serviceworker-reviews, nhiroki, abarth-chromium, falken, blink-reviews-bindings_chromium.org, horo+watch_chromium.org, kinuko+serviceworker, kouhei+heap_chromium.org, alecflett+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/blink.git@master Project:
blink Visibility:
Public. |
DescriptionOilpan: improve ScriptPromiseProperty<>'s argument types.
The ScriptPromiseProperty<> template will instantiate three fields holding
references to objects. In order to ensure lifetime safety, supply better
transition types where it is used.
R=ager@chromium.org,haraken@chromium.org
BUG=
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=178278
Patch Set 1 #Patch Set 2 : Rely on IsGarbageCollectedType<> instead #Patch Set 3 : Remove type-driven tracing changes #
Total comments: 2
Patch Set 4 : Don't add a ref-cycle #
Messages
Total messages: 19 (0 generated)
Please take a look. An alternative way to handle the tracing from ScriptPromiseProperty; too much type hackery?
Yeah, I did consider this. It is clever and it will definitely work, but I do find it to be a bit too much type hackery and it also makes the trace methods less stylized. I personally prefer the #if ENABLE(OILPAN) usages for now. The plugin should find it if we use them wrong and I don't see a case where the ifdef in the trace method will not be enough.
On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > Yeah, I did consider this. It is clever and it will definitely work, but I do > find it to be a bit too much type hackery and it also makes the trace methods > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for now. The > plugin should find it if we use them wrong and I don't see a case where the > ifdef in the trace method will not be enough. ok; please notice that the use of ScriptPromiseProperty in *Test is currently unsafe with the tracing that is now performed. m_rejected is an uninitialized pointer.
On 2014/07/16 10:29:33, sof wrote: > On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > > Yeah, I did consider this. It is clever and it will definitely work, but I do > > find it to be a bit too much type hackery and it also makes the trace methods > > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for now. The > > plugin should find it if we use them wrong and I don't see a case where the > > ifdef in the trace method will not be enough. > > ok; please notice that the use of ScriptPromiseProperty in *Test is currently > unsafe with the tracing that is now performed. m_rejected is an uninitialized > pointer. I think that is actually OK? Uninitialized pointers in heap allocated objects are always 0. We only give back zero-filled memory?
On 2014/07/16 10:31:34, Mads Ager (chromium) wrote: > On 2014/07/16 10:29:33, sof wrote: > > On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > > > Yeah, I did consider this. It is clever and it will definitely work, but I > do > > > find it to be a bit too much type hackery and it also makes the trace > methods > > > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for now. > The > > > plugin should find it if we use them wrong and I don't see a case where the > > > ifdef in the trace method will not be enough. > > > > ok; please notice that the use of ScriptPromiseProperty in *Test is currently > > unsafe with the tracing that is now performed. m_rejected is an uninitialized > > pointer. > > I think that is actually OK? Uninitialized pointers in heap allocated objects > are always 0. We only give back zero-filled memory? But, yeah, it should use RawPtrWillBeMember. Can we land that part of this change? :)
On 2014/07/16 10:32:16, Mads Ager (chromium) wrote: > On 2014/07/16 10:31:34, Mads Ager (chromium) wrote: > > On 2014/07/16 10:29:33, sof wrote: > > > On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > > > > Yeah, I did consider this. It is clever and it will definitely work, but I > > do > > > > find it to be a bit too much type hackery and it also makes the trace > > methods > > > > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for now. > > The > > > > plugin should find it if we use them wrong and I don't see a case where > the > > > > ifdef in the trace method will not be enough. > > > > > > ok; please notice that the use of ScriptPromiseProperty in *Test is > currently > > > unsafe with the tracing that is now performed. m_rejected is an > uninitialized > > > pointer. > > > > I think that is actually OK? Uninitialized pointers in heap allocated objects > > are always 0. We only give back zero-filled memory? > > But, yeah, it should use RawPtrWillBeMember. Can we land that part of this > change? :) m_rejected isn't initialized and a bare pointer. RawPtrWillBeMember<> wouldn't be ideal either; RefPtrWillBeMember<>.
On 2014/07/16 10:34:47, sof wrote: > On 2014/07/16 10:32:16, Mads Ager (chromium) wrote: > > On 2014/07/16 10:31:34, Mads Ager (chromium) wrote: > > > On 2014/07/16 10:29:33, sof wrote: > > > > On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > > > > > Yeah, I did consider this. It is clever and it will definitely work, but > I > > > do > > > > > find it to be a bit too much type hackery and it also makes the trace > > > methods > > > > > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for > now. > > > The > > > > > plugin should find it if we use them wrong and I don't see a case where > > the > > > > > ifdef in the trace method will not be enough. > > > > > > > > ok; please notice that the use of ScriptPromiseProperty in *Test is > > currently > > > > unsafe with the tracing that is now performed. m_rejected is an > > uninitialized > > > > pointer. > > > > > > I think that is actually OK? Uninitialized pointers in heap allocated > objects > > > are always 0. We only give back zero-filled memory? > > > > But, yeah, it should use RawPtrWillBeMember. Can we land that part of this > > change? :) > > m_rejected isn't initialized and a bare pointer. RawPtrWillBeMember<> wouldn't > be ideal either; RefPtrWillBeMember<>. Yes, RefPtrWillBeMember makes sense here. We should update ServiceWorkerContainer.h as well. It has the following typedef: typedef ScriptPromiseProperty<ServiceWorkerContainer*, RefPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProperty; The ServiceWorkerContainer* should be RawPtrWillBeMember<ServiceWorkerContainer> I think?
On 2014/07/16 10:40:55, Mads Ager (chromium) wrote: > On 2014/07/16 10:34:47, sof wrote: > > On 2014/07/16 10:32:16, Mads Ager (chromium) wrote: > > > On 2014/07/16 10:31:34, Mads Ager (chromium) wrote: > > > > On 2014/07/16 10:29:33, sof wrote: > > > > > On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > > > > > > Yeah, I did consider this. It is clever and it will definitely work, > but > > I > > > > do > > > > > > find it to be a bit too much type hackery and it also makes the trace > > > > methods > > > > > > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for > > now. > > > > The > > > > > > plugin should find it if we use them wrong and I don't see a case > where > > > the > > > > > > ifdef in the trace method will not be enough. > > > > > > > > > > ok; please notice that the use of ScriptPromiseProperty in *Test is > > > currently > > > > > unsafe with the tracing that is now performed. m_rejected is an > > > uninitialized > > > > > pointer. > > > > > > > > I think that is actually OK? Uninitialized pointers in heap allocated > > objects > > > > are always 0. We only give back zero-filled memory? > > > > > > But, yeah, it should use RawPtrWillBeMember. Can we land that part of this > > > change? :) > > > > m_rejected isn't initialized and a bare pointer. RawPtrWillBeMember<> wouldn't > > be ideal either; RefPtrWillBeMember<>. > > Yes, RefPtrWillBeMember makes sense here. We should update > ServiceWorkerContainer.h as well. It has the following typedef: > > typedef ScriptPromiseProperty<ServiceWorkerContainer*, > RefPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > > ReadyProperty; > > > The ServiceWorkerContainer* should be RawPtrWillBeMember<ServiceWorkerContainer> > I think? That would be a better type; let's make this CL about ScriptPromiseProperty uses only.
On 2014/07/16 10:46:07, sof wrote: > On 2014/07/16 10:40:55, Mads Ager (chromium) wrote: > > On 2014/07/16 10:34:47, sof wrote: > > > On 2014/07/16 10:32:16, Mads Ager (chromium) wrote: > > > > On 2014/07/16 10:31:34, Mads Ager (chromium) wrote: > > > > > On 2014/07/16 10:29:33, sof wrote: > > > > > > On 2014/07/16 10:25:03, Mads Ager (chromium) wrote: > > > > > > > Yeah, I did consider this. It is clever and it will definitely work, > > but > > > I > > > > > do > > > > > > > find it to be a bit too much type hackery and it also makes the > trace > > > > > methods > > > > > > > less stylized. I personally prefer the #if ENABLE(OILPAN) usages for > > > now. > > > > > The > > > > > > > plugin should find it if we use them wrong and I don't see a case > > where > > > > the > > > > > > > ifdef in the trace method will not be enough. > > > > > > > > > > > > ok; please notice that the use of ScriptPromiseProperty in *Test is > > > > currently > > > > > > unsafe with the tracing that is now performed. m_rejected is an > > > > uninitialized > > > > > > pointer. > > > > > > > > > > I think that is actually OK? Uninitialized pointers in heap allocated > > > objects > > > > > are always 0. We only give back zero-filled memory? > > > > > > > > But, yeah, it should use RawPtrWillBeMember. Can we land that part of this > > > > change? :) > > > > > > m_rejected isn't initialized and a bare pointer. RawPtrWillBeMember<> > wouldn't > > > be ideal either; RefPtrWillBeMember<>. > > > > Yes, RefPtrWillBeMember makes sense here. We should update > > ServiceWorkerContainer.h as well. It has the following typedef: > > > > typedef ScriptPromiseProperty<ServiceWorkerContainer*, > > RefPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > > > ReadyProperty; > > > > > > The ServiceWorkerContainer* should be > RawPtrWillBeMember<ServiceWorkerContainer> > > I think? > > That would be a better type; let's make this CL about ScriptPromiseProperty uses > only. Done; tried to make the description more accurate.
https://codereview.chromium.org/393773004/diff/40001/Source/modules/servicewo... File Source/modules/serviceworkers/ServiceWorkerContainer.h (right): https://codereview.chromium.org/393773004/diff/40001/Source/modules/servicewo... Source/modules/serviceworkers/ServiceWorkerContainer.h:90: typedef ScriptPromiseProperty<RefPtrWillBeMember<ServiceWorkerContainer>, RefPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProperty; It looks to me like this will leak through the tiny ref cycle: ServiceWorkerContainer::m_ready -> ScriptProperty::m_host ^ | | -------------------------------------- It looks like m_ready is always set, so this needs to be RawPtrWillBeMember.
+dominicc
https://codereview.chromium.org/393773004/diff/40001/Source/modules/servicewo... File Source/modules/serviceworkers/ServiceWorkerContainer.h (right): https://codereview.chromium.org/393773004/diff/40001/Source/modules/servicewo... Source/modules/serviceworkers/ServiceWorkerContainer.h:90: typedef ScriptPromiseProperty<RefPtrWillBeMember<ServiceWorkerContainer>, RefPtrWillBeMember<ServiceWorker>, RefPtrWillBeMember<ServiceWorker> > ReadyProperty; On 2014/07/16 11:10:43, Mads Ager (chromium) wrote: > It looks to me like this will leak through the tiny ref cycle: > > ServiceWorkerContainer::m_ready -> ScriptProperty::m_host > ^ > | | > -------------------------------------- > > It looks like m_ready is always set, so this needs to be RawPtrWillBeMember. Ouch, a ref pointing straight back. Thanks much, fixed.
LGTM
On 2014/07/16 11:33:16, Mads Ager (chromium) wrote: > LGTM Thanks, will wait for bindings/ owner and dominicc's feedback.
LGTM
The CQ bit was checked by sigbjornf@opera.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sigbjornf@opera.com/393773004/60001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/17258)
Message was sent while issue was closed.
Change committed as 178278 |