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

Issue 1211353004: (WONT COMMIT) Pass a boPass a bool object allocated on heap to CallbackPromiseAdapter::onSuccess (2) (Closed)

Created:
5 years, 5 months ago by nhiroki
Modified:
5 years, 5 months ago
Reviewers:
haraken, kinuko, yhirano
CC:
blink-reviews, blink-reviews-bindings_chromium.org, vivekg_samsung, arv+blink, vivekg
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Pass a bool object allocated on heap to CallbackPromiseAdapter::onSuccess (2) CallbackPromiseAdapter is designed to take ownership of a passed object. See comments in CallbackPromiseAdapter.h for details. (1) Chromium: https://codereview.chromium.org/1217633003/ (2) Blink: THIS PATCH (3) Chromium: https://codereview.chromium.org/1225543002/ (4) Blink: https://codereview.chromium.org/1221693004/ BUG=493531

Patch Set 1 : #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -6 lines) Patch
M Source/bindings/core/v8/CallbackPromiseAdapter.h View 3 chunks +10 lines, -6 lines 4 comments Download

Dependent Patchsets:

Messages

Total messages: 16 (4 generated)
nhiroki
PTAL
5 years, 5 months ago (2015-07-03 05:54:20 UTC) #3
haraken
https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode257 Source/bindings/core/v8/CallbackPromiseAdapter.h:257: m_resolver->resolve(*ownPtr); This will end up with calling resolveOrReject(OwnPtr<bool>, ...), ...
5 years, 5 months ago (2015-07-03 05:57:49 UTC) #5
yhirano
https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode257 Source/bindings/core/v8/CallbackPromiseAdapter.h:257: m_resolver->resolve(*ownPtr); On 2015/07/03 05:57:49, haraken wrote: > > This ...
5 years, 5 months ago (2015-07-03 06:04:12 UTC) #6
haraken
https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode257 Source/bindings/core/v8/CallbackPromiseAdapter.h:257: m_resolver->resolve(*ownPtr); On 2015/07/03 06:04:12, yhirano wrote: > On 2015/07/03 ...
5 years, 5 months ago (2015-07-03 06:09:06 UTC) #7
nhiroki
https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode257 Source/bindings/core/v8/CallbackPromiseAdapter.h:257: m_resolver->resolve(*ownPtr); On 2015/07/03 06:09:06, haraken wrote: > On 2015/07/03 ...
5 years, 5 months ago (2015-07-03 06:59:40 UTC) #8
haraken
On 2015/07/03 06:59:40, nhiroki wrote: > https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h > File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): > > https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode257 > ...
5 years, 5 months ago (2015-07-03 07:01:46 UTC) #9
yhirano
lgtm
5 years, 5 months ago (2015-07-03 07:24:51 UTC) #10
kinuko
On 2015/07/03 06:59:40, nhiroki wrote: > https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h > File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): > > https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode257 > ...
5 years, 5 months ago (2015-07-03 09:25:34 UTC) #11
nhiroki
On 2015/07/03 09:25:34, kinuko wrote: > On 2015/07/03 06:59:40, nhiroki wrote: > > > https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8/CallbackPromiseAdapter.h ...
5 years, 5 months ago (2015-07-08 07:17:11 UTC) #13
nhiroki
On 2015/07/08 07:17:11, nhiroki (ooo) wrote: > On 2015/07/03 09:25:34, kinuko wrote: > > On ...
5 years, 5 months ago (2015-07-10 04:15:54 UTC) #14
kinuko
On 2015/07/08 07:17:11, nhiroki (ooo) wrote: > On 2015/07/03 09:25:34, kinuko wrote: > > On ...
5 years, 5 months ago (2015-07-10 04:18:48 UTC) #15
kinuko
5 years, 5 months ago (2015-07-10 04:20:10 UTC) #16
On 2015/07/10 04:18:48, kinuko wrote:
> On 2015/07/08 07:17:11, nhiroki (ooo) wrote:
> > On 2015/07/03 09:25:34, kinuko wrote:
> > > On 2015/07/03 06:59:40, nhiroki wrote:
> > > >
> > >
> >
>
https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8...
> > > > File Source/bindings/core/v8/CallbackPromiseAdapter.h (right):
> > > > 
> > > >
> > >
> >
>
https://codereview.chromium.org/1211353004/diff/20001/Source/bindings/core/v8...
> > > > Source/bindings/core/v8/CallbackPromiseAdapter.h:257:
> > > > m_resolver->resolve(*ownPtr);
> > > > On 2015/07/03 06:09:06, haraken wrote:
> > > > > On 2015/07/03 06:04:12, yhirano wrote:
> > > > > > On 2015/07/03 05:57:49, haraken wrote:
> > > > > > > 
> > > > > > > This will end up with calling resolveOrReject(OwnPtr<bool>, ...),
> > which
> > > > will
> > > > > > > call toV8(OwnPtr<bool>, ...). This seems not quite right to me.
> > > > > > > 
> > > > > > > hirano-san?
> > > > > > > 
> > > > > > 
> > > > > > This statement passes |*ownPtr| of type |bool|, so it looks good. Am
I
> > > > missing
> > > > > > anything?
> > > > > 
> > > > > ah, OK. Then what's the merit of using an OwnPtr? It looks a bit
strange
> > to
> > > > use
> > > > > OwnPtr<bool>.
> > > > 
> > > > Sorry, I'm not really sure why you feel this a bit strange... which
> solution
> > > are
> > > > you thinking?
> > > > 
> > > > (1) manually deleting an object,
> > > > (2) passing an object w/o ownership as the original implementation, or
> > > > (3) passing an object by value
> > > > 
> > > > Re (1): I'd prefer a scoped pointer to avoid accidental leak.
> > > > Re (2): This looks a bit awkward to me because other types are passed
with
> > > > ownership.
> > > > Re (3): This should be feasible, but we need to add more WebCallbacks
> > > interfaces
> > > > for bool type.
> > > 
> > > For reference would you be able to tell a bit more details about how much
> more
> > > code we need for doing 3?  I'm feeling allocating a heap for passing a
bool
> is
> > > unfortunate.
> > > I understand the current approach gives the most consistency, but would
like
> > to
> > > weigh the other option a bit if you could help.
> > 
> > I created CLs for pass-by-value version (3). That would be simpler than I
> > expected. WDYT?
> > 
> > (blink) https://codereview.chromium.org/1222103006/
> > (chromium) https://codereview.chromium.org/1218073019/
> 
> (Follow-up) thanks for exploring the idea. As we discussed offline I feel a
> better way to address this would be to stop forcing the consumer of
WebCallback
> to use pointers and fixed ownership semantics at the interface level. Ideally
> it'd be nicer if each consumer can determine what types of value it wants to
> pass and how the ownership should be managed. If changing the design like that
> is too cumbersome before repo merge (i.e. until we start to be able to specify
> ownership semantics using common types) it might be still better to keep it as
> is for this specific bool cases (but with TODO).

(Oops, missed nhiroki's follow-up response before sending this)

Powered by Google App Engine
This is Rietveld 408576698