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

Issue 680193003: IDL: Generate union type containers (Closed)

Created:
6 years, 1 month ago by bashi
Modified:
6 years, 1 month ago
Reviewers:
haraken, Jens Widell, sof, tasak
CC:
blink-reviews, rwlbuis, shans, arv+blink, Mike Lawther (Google), blink-reviews-animation_chromium.org, sof, eae+blinkwatch, dglazkov+blink, dstockwell, Timothy Loh, blink-reviews-dom_chromium.org, blink-reviews-bindings_chromium.org, darktears, rjwright, Steve Block, blink-reviews-html_chromium.org, Eric Willigers
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

IDL: Generate union type containers Commit b8e05fd added a half baked code generator for union type containers. This CL implements the code generator and uses them for union return values. If (A or B) is given, the name of the corresponding container type will be "AOrB". Generated union type containers will have following methods: - isNull(), true when no specific type. - isT(), true when the container holds T. - getAsT(), retrieve the value as T. Need to check isT() before calling this. - setT(), set a value to the container. Allowed only once. When a method/getter returns an union type, the binding layer allocates an instance of the container class on stack, then passes it to impl side as the last argument. The impl method can set a specific value via setT() methods. We already have build steps for IDL dictionary impl class creation, so we can use the step for union type containers creation as well. The code generator takes individual interfaces info, which contains collected union types, then generates container classes from the information. This CL doesn't change the web-faced behavior. BUG=240176 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=184684

Patch Set 1 #

Total comments: 26

Patch Set 2 : #

Total comments: 36

Patch Set 3 : #

Total comments: 3

Patch Set 4 : #

Total comments: 22

Patch Set 5 : #

Total comments: 8

Patch Set 6 : #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+1366 lines, -332 lines) Patch
M Source/bindings/core/BUILD.gn View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/core/generated.gyp View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/core/v8/BUILD.gn View 1 2 3 4 2 chunks +9 lines, -4 lines 0 comments Download
M Source/bindings/core/v8/V8BindingMacros.h View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/generated.gni View 1 chunk +5 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/generated.gyp View 1 2 3 4 5 chunks +14 lines, -4 lines 0 comments Download
M Source/bindings/core/v8/generated.gypi View 1 chunk +4 lines, -0 lines 0 comments Download
M Source/bindings/modules/BUILD.gn View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/modules/generated.gyp View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/modules/v8/BUILD.gn View 1 2 3 4 2 chunks +9 lines, -4 lines 0 comments Download
M Source/bindings/modules/v8/generated.gni View 1 chunk +7 lines, -0 lines 0 comments Download
M Source/bindings/modules/v8/generated.gyp View 1 2 3 4 4 chunks +14 lines, -5 lines 0 comments Download
M Source/bindings/modules/v8/generated.gypi View 1 chunk +5 lines, -0 lines 0 comments Download
M Source/bindings/scripts/code_generator_v8.py View 1 2 3 4 5 chunks +17 lines, -11 lines 0 comments Download
M Source/bindings/scripts/compute_interfaces_info_individual.py View 1 2 3 4 5 chunks +14 lines, -4 lines 0 comments Download
M Source/bindings/scripts/compute_interfaces_info_overall.py View 2 chunks +5 lines, -0 lines 0 comments Download
M Source/bindings/scripts/idl_compiler.py View 1 2 3 4 4 chunks +25 lines, -4 lines 0 comments Download
M Source/bindings/scripts/interfaces_info_individual.gypi View 1 2 3 4 3 chunks +7 lines, -3 lines 0 comments Download
M Source/bindings/scripts/scripts.gni View 1 2 3 4 5 chunks +24 lines, -8 lines 0 comments Download
M Source/bindings/scripts/v8_interface.py View 1 2 3 chunks +6 lines, -10 lines 0 comments Download
M Source/bindings/scripts/v8_methods.py View 1 2 6 chunks +9 lines, -46 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 2 3 4 5 9 chunks +15 lines, -33 lines 0 comments Download
M Source/bindings/scripts/v8_union.py View 1 2 3 4 5 1 chunk +78 lines, -3 lines 0 comments Download
M Source/bindings/templates/interface.cpp View 1 2 3 4 5 3 chunks +4 lines, -4 lines 0 comments Download
M Source/bindings/templates/methods.cpp View 1 2 3 4 3 chunks +1 line, -28 lines 0 comments Download
M Source/bindings/templates/union.h View 1 2 1 chunk +44 lines, -1 line 3 comments Download
M Source/bindings/templates/union.cpp View 1 2 3 4 5 1 chunk +128 lines, -1 line 0 comments Download
M Source/bindings/tests/idls/core/TestObject.idl View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/UnionTypesCore.h View 1 2 3 4 5 1 chunk +274 lines, -7 lines 0 comments Download
M Source/bindings/tests/results/core/UnionTypesCore.cpp View 1 2 3 4 5 1 chunk +514 lines, -1 line 1 comment Download
M Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 4 5 5 chunks +30 lines, -45 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestSpecialOperations.cpp View 1 3 chunks +8 lines, -25 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 3 chunks +7 lines, -24 lines 0 comments Download
M Source/core/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/animation/AnimationNodeTiming.h View 3 chunks +3 lines, -2 lines 0 comments Download
M Source/core/animation/AnimationNodeTiming.cpp View 2 chunks +5 lines, -3 lines 0 comments Download
M Source/core/animation/AnimationTest.cpp View 4 chunks +21 lines, -25 lines 0 comments Download
M Source/core/core.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/dom/Document.h View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/dom/Document.cpp View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
M Source/core/dom/ParentNode.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLAllCollection.h View 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/html/HTMLAllCollection.cpp View 3 chunks +4 lines, -3 lines 0 comments Download
M Source/core/html/HTMLFormControlsCollection.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/html/HTMLFormControlsCollection.cpp View 3 chunks +4 lines, -3 lines 0 comments Download
M Source/core/html/HTMLFormElement.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/html/HTMLFormElement.cpp View 3 chunks +4 lines, -3 lines 0 comments Download
M Source/core/html/HTMLOptionsCollection.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/html/HTMLOptionsCollection.cpp View 3 chunks +4 lines, -3 lines 0 comments Download
M Source/modules/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M Source/modules/modules.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M Tools/Scripts/webkitpy/bindings/main.py View 1 2 3 4 3 chunks +5 lines, -2 lines 0 comments Download

Messages

Total messages: 26 (6 generated)
bashi
Could you take a look? https://codereview.chromium.org/680193003/diff/1/Source/bindings/tests/results/core/UnionTypesCore.cpp File Source/bindings/tests/results/core/UnionTypesCore.cpp (right): https://codereview.chromium.org/680193003/diff/1/Source/bindings/tests/results/core/UnionTypesCore.cpp#newcode70 Source/bindings/tests/results/core/UnionTypesCore.cpp:70: V8 -> impl conversion ...
6 years, 1 month ago (2014-10-28 10:09:15 UTC) #2
Jens Widell
Looks mostly very good, but some comments. https://codereview.chromium.org/680193003/diff/1/Source/bindings/core/v8/generated.gyp File Source/bindings/core/v8/generated.gyp (right): https://codereview.chromium.org/680193003/diff/1/Source/bindings/core/v8/generated.gyp#newcode151 Source/bindings/core/v8/generated.gyp:151: '<(bindings_core_output_dir)/InterfacesInfoCoreIndividual.pickle', Add ...
6 years, 1 month ago (2014-10-28 11:31:38 UTC) #3
bashi
Thank you for review! https://codereview.chromium.org/680193003/diff/1/Source/bindings/core/v8/generated.gyp File Source/bindings/core/v8/generated.gyp (right): https://codereview.chromium.org/680193003/diff/1/Source/bindings/core/v8/generated.gyp#newcode151 Source/bindings/core/v8/generated.gyp:151: '<(bindings_core_output_dir)/InterfacesInfoCoreIndividual.pickle', On 2014/10/28 11:31:37, Jens ...
6 years, 1 month ago (2014-10-29 01:34:33 UTC) #5
haraken
Mostly looks good. https://codereview.chromium.org/680193003/diff/40001/Source/bindings/modules/v8/generated.gyp File Source/bindings/modules/v8/generated.gyp (right): https://codereview.chromium.org/680193003/diff/40001/Source/bindings/modules/v8/generated.gyp#newcode153 Source/bindings/modules/v8/generated.gyp:153: '<(SHARED_INTERMEDIATE_DIR)/blink/', Just help me understand: Why ...
6 years, 1 month ago (2014-10-29 04:59:30 UTC) #6
Jens Widell
https://codereview.chromium.org/680193003/diff/40001/Source/bindings/templates/union.cpp File Source/bindings/templates/union.cpp (right): https://codereview.chromium.org/680193003/diff/40001/Source/bindings/templates/union.cpp#newcode39 Source/bindings/templates/union.cpp:39: {# FIXME: We doesn't follow the spec on handling ...
6 years, 1 month ago (2014-10-29 07:18:51 UTC) #7
bashi
https://codereview.chromium.org/680193003/diff/40001/Source/bindings/modules/v8/generated.gyp File Source/bindings/modules/v8/generated.gyp (right): https://codereview.chromium.org/680193003/diff/40001/Source/bindings/modules/v8/generated.gyp#newcode153 Source/bindings/modules/v8/generated.gyp:153: '<(SHARED_INTERMEDIATE_DIR)/blink/', On 2014/10/29 04:59:29, haraken wrote: > > Just ...
6 years, 1 month ago (2014-10-29 09:57:37 UTC) #9
Jens Widell
https://codereview.chromium.org/680193003/diff/40001/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py (right): https://codereview.chromium.org/680193003/diff/40001/Source/bindings/scripts/v8_types.py#newcode749 Source/bindings/scripts/v8_types.py:749: 'StackAllocatedContainer': 'v8SetReturnValue(info, result)', On 2014/10/29 09:57:36, bashi1 wrote: > ...
6 years, 1 month ago (2014-10-29 11:40:45 UTC) #10
bashi
https://codereview.chromium.org/680193003/diff/40001/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py (right): https://codereview.chromium.org/680193003/diff/40001/Source/bindings/scripts/v8_types.py#newcode749 Source/bindings/scripts/v8_types.py:749: 'StackAllocatedContainer': 'v8SetReturnValue(info, result)', On 2014/10/29 11:40:45, Jens Widell wrote: ...
6 years, 1 month ago (2014-10-30 01:34:37 UTC) #11
haraken
I have a question about how toImpl should work :) https://codereview.chromium.org/680193003/diff/100001/Source/bindings/core/BUILD.gn File Source/bindings/core/BUILD.gn (right): https://codereview.chromium.org/680193003/diff/100001/Source/bindings/core/BUILD.gn#newcode18 ...
6 years, 1 month ago (2014-10-30 08:39:27 UTC) #12
Jens Widell
https://codereview.chromium.org/680193003/diff/100001/Source/bindings/tests/results/core/UnionTypesCore.cpp File Source/bindings/tests/results/core/UnionTypesCore.cpp (right): https://codereview.chromium.org/680193003/diff/100001/Source/bindings/tests/results/core/UnionTypesCore.cpp#newcode211 Source/bindings/tests/results/core/UnionTypesCore.cpp:211: if (v8Value->IsNumber()) { On 2014/10/30 08:39:26, haraken wrote: > ...
6 years, 1 month ago (2014-10-30 08:49:14 UTC) #13
bashi
https://codereview.chromium.org/680193003/diff/100001/Source/bindings/core/BUILD.gn File Source/bindings/core/BUILD.gn (right): https://codereview.chromium.org/680193003/diff/100001/Source/bindings/core/BUILD.gn#newcode18 Source/bindings/core/BUILD.gn:18: "$bindings_core_output_dir/ComponentWideInfoCore.pickle" On 2014/10/30 08:39:26, haraken wrote: > > Nit: ...
6 years, 1 month ago (2014-10-30 12:20:48 UTC) #15
Jens Widell
https://codereview.chromium.org/680193003/diff/100001/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py (right): https://codereview.chromium.org/680193003/diff/100001/Source/bindings/scripts/v8_types.py#newcode166 Source/bindings/scripts/v8_types.py:166: return idl_type.name On 2014/10/30 12:20:48, bashi1 wrote: > On ...
6 years, 1 month ago (2014-10-30 12:31:50 UTC) #16
haraken
LGTM. Let's wait for Jens' approval. https://codereview.chromium.org/680193003/diff/140001/Source/bindings/scripts/v8_union.py File Source/bindings/scripts/v8_union.py (right): https://codereview.chromium.org/680193003/diff/140001/Source/bindings/scripts/v8_union.py#newcode31 Source/bindings/scripts/v8_union.py:31: # These variables ...
6 years, 1 month ago (2014-10-30 13:01:30 UTC) #17
Jens Widell
LGTM too. Great work! https://codereview.chromium.org/680193003/diff/140001/Source/bindings/templates/union.cpp File Source/bindings/templates/union.cpp (right): https://codereview.chromium.org/680193003/diff/140001/Source/bindings/templates/union.cpp#newcode98 Source/bindings/templates/union.cpp:98: return; Aren't we missing an ...
6 years, 1 month ago (2014-10-30 14:04:07 UTC) #18
bashi
Thank you for reviewing this large CL! I'm going to land this CL. https://codereview.chromium.org/680193003/diff/100001/Source/bindings/scripts/v8_types.py File ...
6 years, 1 month ago (2014-10-30 23:19:19 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/680193003/160001
6 years, 1 month ago (2014-10-30 23:30:07 UTC) #21
commit-bot: I haz the power
Committed patchset #6 (id:160001) as 184684
6 years, 1 month ago (2014-10-31 01:50:08 UTC) #22
sof
https://codereview.chromium.org/680193003/diff/160001/Source/bindings/templates/union.h File Source/bindings/templates/union.h (right): https://codereview.chromium.org/680193003/diff/160001/Source/bindings/templates/union.h#newcode22 Source/bindings/templates/union.h:22: ALLOW_ONLY_INLINE_ALLOCATION(); Looks like this doesn't generate a trace() method, ...
6 years, 1 month ago (2014-10-31 06:48:21 UTC) #24
sof
https://codereview.chromium.org/680193003/diff/160001/Source/bindings/templates/union.h File Source/bindings/templates/union.h (right): https://codereview.chromium.org/680193003/diff/160001/Source/bindings/templates/union.h#newcode22 Source/bindings/templates/union.h:22: ALLOW_ONLY_INLINE_ALLOCATION(); On 2014/10/31 06:48:20, sof wrote: > Looks like ...
6 years, 1 month ago (2014-10-31 06:52:23 UTC) #25
Jens Widell
6 years, 1 month ago (2014-10-31 07:24:02 UTC) #26
Message was sent while issue was closed.
https://codereview.chromium.org/680193003/diff/160001/Source/bindings/templat...
File Source/bindings/templates/union.h (right):

https://codereview.chromium.org/680193003/diff/160001/Source/bindings/templat...
Source/bindings/templates/union.h:22: ALLOW_ONLY_INLINE_ALLOCATION();
On 2014/10/31 06:52:23, sof wrote:
> On 2014/10/31 06:48:20, sof wrote:
> > Looks like this doesn't generate a trace() method, which is required.
> > 
> > 
> >
>
http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Oilpan%...
> 
> Just to be clear(er), 
> 
>   s/required/required if the generated type has one or more Member<>s/

https://codereview.chromium.org/689013002/

Powered by Google App Engine
This is Rietveld 408576698