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

Issue 1719873003: Mojom runtime type info: New implementation for Go. (Closed)

Created:
4 years, 10 months ago by rudominer
Modified:
4 years, 10 months ago
Reviewers:
alexfandrianto, azani
CC:
mojo-reviews_chromium.org, gregsimon, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org, yzshen+mojopublicwatch_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Mojom runtime type info: New implementation for Go. Our implementation of runtime type information is changing and this CL implements the change for Go. The older implementation still exists for Dart. (Those are the only two languages for which the runtime type info has yet been implemented.) In the older implementation the runtime type structures are computed and constructed by the code generators (thus in Python and the Jinja 2 templates). In this newer implementation the Mojom parser computes the information and stores it in a mojom_types.RuntimeTypeInfo structure. Then the code generators insert a literal array of bytes representing a serialized RuntimeTypeInfo into the generated Go code. At runtime all a Mojo application needs to do is deserialize the RuntimeTypeInfo struct and use it to answer queries. - In mojom_translator.py copy serialized_runtime_type_info into the mojom.Module. - In mojom_go_generator.py we compute a Go literal string defining this array of bytes. - In source.tmpl we generate Go code to deserialize this array of bytes into a RuntimeTypeInfo struct and use this struct to answer queries about runtime type info. - We delete the old implementation from source.tmpl and delete the files mojom_reference_macros.tmpl and mojom_type_macros.tmpl. - We fix up validation_type_test.go in accordance with these changes. The main change is that we use the format of the type key currently being generated by the mojom parser. Also the old implementation was apparently setting field names in DeclData incorrectly so we modify the tests to look for the correct names. - The new implementation does not support generating the function GetTopLevelInterface() on interfaces that are not top-level interfaces. Therefore we add the "ServiceName" annotation to the interface that is being used to test this function: the BoundsCheckTestInterface in validation_test_interfaces.mojom. BUG=#448 R=alexfandrianto@google.com, azani@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/4970253149a7bc1d057c13fd8f173f2c795b3bfd

Patch Set 1 #

Patch Set 2 : Remove TODO. #

Total comments: 14

Patch Set 3 : Adds mojom_type_key field and deletes GetMojomTypeValue() function. #

Patch Set 4 : Avoid possibility of nil pointer in test. #

Patch Set 5 : Rebasing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -389 lines) Patch
M mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/validation_test_interfaces.mojom.dart View 1 chunk +1 line, -1 line 0 comments Download
M mojo/go/tests/validation_type_test.go View 1 2 3 13 chunks +49 lines, -31 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/go_templates/enum.tmpl View 2 chunks +0 lines, -4 lines 0 comments Download
M mojo/public/tools/bindings/generators/go_templates/interface.tmpl View 4 chunks +5 lines, -4 lines 0 comments Download
D mojo/public/tools/bindings/generators/go_templates/mojom_reference_macros.tmpl View 1 chunk +0 lines, -31 lines 0 comments Download
D mojo/public/tools/bindings/generators/go_templates/mojom_type_macros.tmpl View 1 chunk +0 lines, -232 lines 0 comments Download
M mojo/public/tools/bindings/generators/go_templates/source.tmpl View 1 chunk +15 lines, -42 lines 0 comments Download
M mojo/public/tools/bindings/generators/go_templates/struct.tmpl View 2 chunks +0 lines, -3 lines 0 comments Download
M mojo/public/tools/bindings/generators/go_templates/union.tmpl View 2 chunks +0 lines, -3 lines 0 comments Download
M mojo/public/tools/bindings/generators/mojom_go_generator.py View 1 2 5 chunks +31 lines, -38 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/module.py View 1 2 5 chunks +7 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator.py View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py View 1 2 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (17 generated)
rudominer
Hi Alex and Alex, ptal. -Mitch
4 years, 10 months ago (2016-02-23 16:56:29 UTC) #15
azani
lgtm
4 years, 10 months ago (2016-02-23 19:02:49 UTC) #16
alexfandrianto
On 2016/02/23 19:02:49, azani wrote: > lgtm This looks like it'll be fine. I believe ...
4 years, 10 months ago (2016-02-23 21:19:31 UTC) #17
alexfandrianto
https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go File mojo/go/tests/validation_type_test.go (right): https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go#newcode25 mojo/go/tests/validation_type_test.go:25: // in mojom/mojom_descriptor.go in the Mojom parser source code. ...
4 years, 10 months ago (2016-02-23 21:19:47 UTC) #18
rudominer
On 2016/02/23 21:19:31, alexfandrianto wrote: > On 2016/02/23 19:02:49, azani wrote: > > lgtm > ...
4 years, 10 months ago (2016-02-23 21:31:52 UTC) #19
rudominer
alexfandrianto: Please take a look at my responses to your comments. https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go File mojo/go/tests/validation_type_test.go (right): ...
4 years, 10 months ago (2016-02-23 21:32:22 UTC) #20
alexfandrianto
https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go File mojo/go/tests/validation_type_test.go (right): https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go#newcode25 mojo/go/tests/validation_type_test.go:25: // in mojom/mojom_descriptor.go in the Mojom parser source code. ...
4 years, 10 months ago (2016-02-23 22:00:04 UTC) #21
rudominer
https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go File mojo/go/tests/validation_type_test.go (right): https://codereview.chromium.org/1719873003/diff/180001/mojo/go/tests/validation_type_test.go#newcode25 mojo/go/tests/validation_type_test.go:25: // in mojom/mojom_descriptor.go in the Mojom parser source code. ...
4 years, 10 months ago (2016-02-24 00:03:01 UTC) #22
rudominer
The latest two patchsets include the following changes: - I responded to some of @alexfandrianto's ...
4 years, 10 months ago (2016-02-24 02:06:53 UTC) #24
alexfandrianto
On 2016/02/24 02:06:53, rudominer wrote: > The latest two patchsets include the following changes: > ...
4 years, 10 months ago (2016-02-25 00:38:07 UTC) #25
azani
lgtm
4 years, 10 months ago (2016-02-25 01:28:55 UTC) #26
rudominer
4 years, 10 months ago (2016-02-25 17:25:27 UTC) #28
Message was sent while issue was closed.
Committed patchset #5 (id:260001) manually as
4970253149a7bc1d057c13fd8f173f2c795b3bfd (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698