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

Issue 103703002: Gin: Add support for binding JS methods to C++ instance methods. (Closed)

Created:
7 years ago by Aaron Boodman
Modified:
7 years ago
CC:
chromium-reviews, erikwright+watch_chromium.org, jochen (gone - plz use gerrit)
Visibility:
Public.

Description

Gin: Add support for binding JS methods to C++ instance methods. Also: - Added support for computed properties to ObjectTemplateBuilder - Realized it was possible for CreateFunctionTemplate to be just one template BUG= R=abarth@chromium.org, jyasskin@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=239126

Patch Set 1 #

Patch Set 2 : blah #

Total comments: 11

Patch Set 3 : blah #

Patch Set 4 : blah #

Patch Set 5 : rebase again #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+389 lines, -238 lines) Patch
M base/template_util.h View 1 1 chunk +33 lines, -0 lines 0 comments Download
M base/template_util_unittest.cc View 1 1 chunk +50 lines, -0 lines 0 comments Download
M gin/arguments.h View 1 2 chunks +1 line, -5 lines 0 comments Download
M gin/arguments.cc View 1 1 chunk +0 lines, -6 lines 0 comments Download
M gin/function_template.h View 1 2 3 4 4 chunks +144 lines, -149 lines 0 comments Download
M gin/function_template.h.pump View 1 2 3 4 4 chunks +66 lines, -38 lines 0 comments Download
M gin/object_template_builder.h View 1 2 3 chunks +73 lines, -6 lines 5 comments Download
M gin/object_template_builder.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M gin/try_catch.cc View 1 2 chunks +4 lines, -1 line 0 comments Download
M gin/wrappable.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M gin/wrappable.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M gin/wrappable_unittest.cc View 1 2 3 4 4 chunks +8 lines, -31 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Aaron Boodman
I know that I'll need to rebase this, but let's review it at this old ...
7 years ago (2013-12-04 07:05:28 UTC) #1
Aaron Boodman
+jyasskin for template_util* (I'll get an OWNER to rubberstamp after)
7 years ago (2013-12-04 07:06:55 UTC) #2
abarth-chromium
LGTM https://codereview.chromium.org/103703002/diff/20001/gin/function_template.h File gin/function_template.h (right): https://codereview.chromium.org/103703002/diff/20001/gin/function_template.h#newcode43 gin/function_template.h:43: struct RemoveConstRef<const T*> { This seems like a ...
7 years ago (2013-12-04 16:27:54 UTC) #3
Aaron Boodman
jyasskin: can you also check the usage of is_member_function_pointer in arguments.h?
7 years ago (2013-12-04 18:47:24 UTC) #4
Jeffrey Yasskin
Mostly lgtm https://codereview.chromium.org/103703002/diff/20001/base/template_util.h File base/template_util.h (right): https://codereview.chromium.org/103703002/diff/20001/base/template_util.h#newcode31 base/template_util.h:31: // Member function pointer detection up to ...
7 years ago (2013-12-04 20:00:11 UTC) #5
Aaron Boodman
On Wed, Dec 4, 2013 at 12:00 PM, <jyasskin@chromium.org> wrote: > Mostly lgtm > > ...
7 years ago (2013-12-04 21:52:55 UTC) #6
Aaron Boodman
On Wed, Dec 4, 2013 at 12:00 PM, <jyasskin@chromium.org> wrote: Mostly lgtm https://codereview.chromium.org/103703002/diff/20001/base/template_util.h File base/template_util.h ...
7 years ago (2013-12-04 21:53:00 UTC) #7
Aaron Boodman
+darin for rubberstamp -- Albert, if you have any changes you want, I'll be happy ...
7 years ago (2013-12-05 21:40:43 UTC) #8
Aaron Boodman
Committed patchset #5 manually as r239126.
7 years ago (2013-12-06 06:55:29 UTC) #9
awong
Sorry for the late review. Here's a few comments. Feel free to address in another ...
7 years ago (2013-12-10 02:37:23 UTC) #10
Jeffrey Yasskin
7 years ago (2013-12-10 02:42:45 UTC) #11
Message was sent while issue was closed.
https://codereview.chromium.org/103703002/diff/80001/gin/object_template_buil...
File gin/object_template_builder.h (right):

https://codereview.chromium.org/103703002/diff/80001/gin/object_template_buil...
gin/object_template_builder.h:18: namespace {
On 2013/12/10 02:37:24, awong wrote:
> erp...I'm concerned about putting an anonymous namespace in a header.
> 
> I think that if you have a.cc and b.cc both of which cause an instantiation of
> CreateTemplate<<MyType>, the final binary will end up with 2 blobs of code for
> what is effectively the same function.

Very good catch. It actually causes undefined behavior because
ObjectTemplateBuilder winds up with different definitions in different
translation units, although most of the time the compiler won't hurt you with
it.

> If I'm right, then the workaround is to use a nested named namespace like
> internal.

+1.

https://codereview.chromium.org/103703002/diff/80001/gin/object_template_buil...
gin/object_template_builder.h:46: base::is_member_function_pointer<T>::value
>::type> {
On 2013/12/10 02:37:24, awong wrote:
> Also, can this be simplified to just be an enable_if around T on the first
> template?
> 
> template<typename T>
> struct CallbackTraits<
>   typename base::enable_if<
>      base::is_member_function_pointer<T>::value, T>::type> {
> };

Probably not, because he's using the specialization to define different
definitions for different template arguments, and that sort of structure
matching won't deduce 'T' through a nested typedef.

Powered by Google App Engine
This is Rietveld 408576698