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

Issue 2749253002: bindings: Expand typedefs before generating union files. (Closed)

Created:
3 years, 9 months ago by Raphael Kubo da Costa (rakuco)
Modified:
3 years, 9 months ago
Reviewers:
haraken, bashi, Yuki
CC:
chromium-reviews, blink-reviews, blink-reviews-bindings_chromium.org, Peter Beverloo
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

bindings: Expand typedefs before generating union files. Prior to this commit, the IDL compiler was failing to resolve typedefs in unions before generating new union code. In practice, this meant an IDL construct such as: typedef boolean Foo; void func((Foo or long) arg); Generated FooOrLong.cpp and FooOrLong.h, and "Foo" was considered an IDL interface instead of a simple bool. Since Foo.cpp and Foo.h do not exist, and neither does the Foo class, this caused build failures. We now resolve the typedefs earlier, and in the example above we would now generate BooleanOrLong.cpp and BooleanOrLong.h, which works as expected. Fixing this requires a few separate, intertwined changes: * IdlUnionType.resolve_typedefs() was broken: the |typedefs| argument it receives is a dictionary whose keys are typedef names, not IdlTypeBase-derived objects, so |typedefs.get()| was always failing and returning the original, unresolved member objects. * CodeGeneratorUnionType actually needs to call resolve_typedefs(). It was the only generator class not doing so. The mechanism needs to be different from the other classes though, as IdlUnionType is not a type defined in idl_definitions.py as is the case for the types handled by the other generators. Instead of using TypedefResolver, we simply call the relevant parts of it manually. * The code manually adding union header includes to interfaces and partial interfaces has been dropped: there isn't enough information to resolve the typedefs at that point, which meant interface .cpp files would include FooOrLong.h, while interface .h files include BooleanOrLong.h. The test expectations IDL files show a reduction in unneeded includes, and the build seems to work fine. BUG=701411 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org Review-Url: https://codereview.chromium.org/2749253002 Cr-Commit-Position: refs/heads/master@{#457377} Committed: https://chromium.googlesource.com/chromium/src/+/200763220d087ef3ccf735855398ec193db29658

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+783 lines, -39 lines) Patch
M third_party/WebKit/Source/bindings/scripts/code_generator_v8.py View 1 chunk +8 lines, -0 lines 2 comments Download
M third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py View 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_overall.py View 1 chunk +0 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/idl_types.py View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/scripts/idl_types_test.py View 1 chunk +36 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/idls/core/TestDictionary.idl View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/idls/core/TestTypedefs.idl View 3 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/idls/modules/TestInterfacePartial3.idl View 1 chunk +3 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.h View 1 chunk +96 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.cpp View 1 chunk +109 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/FloatOrBoolean.h View 1 chunk +94 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/FloatOrBoolean.cpp View 1 chunk +112 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/LongOrTestDictionary.cpp View 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/TestDictionary.h View 3 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/TestDictionary.cpp View 3 chunks +10 lines, -2 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/UnsignedLongLongOrBooleanOrTestCallbackInterface.h View 1 chunk +103 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/UnsignedLongLongOrBooleanOrTestCallbackInterface.cpp View 1 chunk +139 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp View 3 chunks +20 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 2 chunks +0 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.h View 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 5 chunks +23 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/XMLHttpRequestOrString.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp View 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.h View 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp View 4 chunks +14 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 16 (8 generated)
Raphael Kubo da Costa (rakuco)
PTAL. The only parts I'm not 100% confident about are the changes to compute_interfaces_info_individual.py and ...
3 years, 9 months ago (2017-03-15 11:16:12 UTC) #4
Yuki
I'm not an expert in this area though, looks good to me in general. Defer ...
3 years, 9 months ago (2017-03-15 13:52:38 UTC) #7
Raphael Kubo da Costa (rakuco)
(just fyi, the chromeos browser test failure seems to be unrelated to this CL, https://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20(1) ...
3 years, 9 months ago (2017-03-15 17:32:27 UTC) #8
bashi
Great fix! lgtm. Sorry for the late review (I'm ooo every Wed in JST). https://codereview.chromium.org/2749253002/diff/1/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py ...
3 years, 9 months ago (2017-03-15 23:27:11 UTC) #9
Raphael Kubo da Costa (rakuco)
https://codereview.chromium.org/2749253002/diff/1/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py File third_party/WebKit/Source/bindings/scripts/code_generator_v8.py (right): https://codereview.chromium.org/2749253002/diff/1/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py#newcode294 third_party/WebKit/Source/bindings/scripts/code_generator_v8.py:294: self.typedefs = {} On 2017/03/15 23:27:11, bashi wrote: > ...
3 years, 9 months ago (2017-03-16 08:04:48 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2749253002/1
3 years, 9 months ago (2017-03-16 08:20:56 UTC) #12
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/200763220d087ef3ccf735855398ec193db29658
3 years, 9 months ago (2017-03-16 08:57:36 UTC) #15
haraken
3 years, 9 months ago (2017-03-16 10:14:19 UTC) #16
Message was sent while issue was closed.
LGTM

Powered by Google App Engine
This is Rietveld 408576698