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

Issue 611633002: mojom: Add associative arrays to the mojom language. (Closed)

Created:
6 years, 2 months ago by Elliot Glaysher
Modified:
6 years, 2 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, dcheng, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

mojom: Add associative arrays to the mojom language. This adds associative arrays to mojom to the main parser, and the C++ bindings generator. This adds a mojo::Map<> class to the C++ bindings, used by the generated bindings. Finally, it moves the clipboard.mojom interface over to associative arrays (which was the inspiration to add them to the mojom language). BUG=413863 Committed: https://crrev.com/0f8647ec517acc9e80b0529fdb91fbd759ce85c3 Cr-Commit-Position: refs/heads/master@{#299017}

Patch Set 1 #

Total comments: 8

Patch Set 2 : Implement struct serialization and restruct what can be the key in an associative_array. #

Patch Set 3 : Theoretically fix the python tests. #

Patch Set 4 : Fix order of parsing associative arrays so uint8[string][] is Map<String, Array<uint8_t>>. #

Patch Set 5 : Move the clipboard interface to maps. Replace Map::Iterate() with begin()/end(). Still need to fix … #

Patch Set 6 : Fix gn build. #

Total comments: 14

Patch Set 7 : map<> syntax in mojom. Map<> is now Clone()able. Add size validation. #

Patch Set 8 : Add Clone() test, and fix python unit tests. #

Patch Set 9 : Only changes: mojom.gni rebase and just yzshen's patch for array of maps #

Patch Set 10 : Revert yzshen's patch; have that go in later. #

Patch Set 11 : Rework the entire patch to use a Map_Data which is a struct. #

Patch Set 12 : Rebase to ToT #

Patch Set 13 : Rebase to ToT; fixes clang-format bustage. #

Total comments: 9

Patch Set 14 : vtl nits #

Patch Set 15 : Rebase to ToT #

Total comments: 10

Patch Set 16 : Suppress pylint warnings instead of making MapKind public. #

Total comments: 20

Patch Set 17 : Address yzshen's comments. #

Total comments: 5

Patch Set 18 : final nits #

Patch Set 19 : Remove usage of the new feature in mojom files. Will be readded in a later patch. #

Total comments: 5

Patch Set 20 : Moved test classes to their own shared file. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1431 lines, -85 lines) Patch
M mojo/edk/mojo_edk.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +5 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/array.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download
M mojo/public/cpp/bindings/lib/array_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +11 lines, -21 lines 0 comments Download
M mojo/public/cpp/bindings/lib/array_serialization.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +20 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/map_data_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +118 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/map_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +200 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/map_serialization.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +156 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/validate_params.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +36 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/validation_errors.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/validation_errors.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/map.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +207 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/string.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +17 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/array_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +1 line, -54 lines 0 comments Download
A mojo/public/cpp/bindings/tests/container_test_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +52 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/container_test_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +50 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/map_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +338 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/string_unittest.cc View 1 2 3 1 chunk +11 lines, -0 lines 0 comments Download
M mojo/public/mojo_public.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +4 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/mojom_cpp_generator.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 10 chunks +36 lines, -3 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/data.py View 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/module.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +33 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/pack.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/parse/lexer.py View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/parse/parser.py View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/parse/translate.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +5 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/pylib/mojom_tests/parse/lexer_unittest.py View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/pylib/mojom_tests/parse/parser_unittest.py View 1 2 3 4 5 6 7 1 chunk +41 lines, -0 lines 0 comments Download
A mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +47 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (4 generated)
Elliot Glaysher
This is asking more for a feasibility review; this patch is a long way from ...
6 years, 2 months ago (2014-09-26 22:08:45 UTC) #2
yzshen1
(I did a quick look.) This approach looks good to me. It reduces complexity significantly. ...
6 years, 2 months ago (2014-09-27 00:01:58 UTC) #3
viettrungluu
https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py File mojo/public/tools/bindings/pylib/mojom/parse/parser.py (right): https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py#newcode240 mojo/public/tools/bindings/pylib/mojom/parse/parser.py:240: | associated_array "associated" -> "associative" https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py#newcode280 mojo/public/tools/bindings/pylib/mojom/parse/parser.py:280: """associated_array : ...
6 years, 2 months ago (2014-09-29 19:34:48 UTC) #4
yzshen1
https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py File mojo/public/tools/bindings/pylib/mojom/parse/parser.py (right): https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py#newcode280 mojo/public/tools/bindings/pylib/mojom/parse/parser.py:280: """associated_array : typename LBRACKET basictypename RBRACKET""" On 2014/09/29 19:34:47, ...
6 years, 2 months ago (2014-09-29 19:53:24 UTC) #5
viettrungluu
On 2014/09/29 19:53:24, yzshen1 wrote: > https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py > File mojo/public/tools/bindings/pylib/mojom/parse/parser.py (right): > > https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py#newcode280 > ...
6 years, 2 months ago (2014-10-02 02:34:51 UTC) #6
yzshen1
On 2014/10/02 02:34:51, viettrungluu wrote: > On 2014/09/29 19:53:24, yzshen1 wrote: > > > https://codereview.chromium.org/611633002/diff/1/mojo/public/tools/bindings/pylib/mojom/parse/parser.py ...
6 years, 2 months ago (2014-10-02 05:15:13 UTC) #7
viettrungluu
On 2014/10/02 05:15:13, yzshen1 wrote: > On 2014/10/02 02:34:51, viettrungluu wrote: > > On 2014/09/29 ...
6 years, 2 months ago (2014-10-02 06:10:24 UTC) #8
viettrungluu
On 2014/10/02 06:10:24, viettrungluu wrote: > On 2014/10/02 05:15:13, yzshen1 wrote: > > On 2014/10/02 ...
6 years, 2 months ago (2014-10-02 07:04:53 UTC) #9
yzshen1
On 2014/10/02 07:04:53, viettrungluu wrote: > On 2014/10/02 06:10:24, viettrungluu wrote: > > On 2014/10/02 ...
6 years, 2 months ago (2014-10-02 07:37:58 UTC) #10
yzshen1
On 2014/10/02 07:37:58, yzshen1 wrote: > On 2014/10/02 07:04:53, viettrungluu wrote: > > On 2014/10/02 ...
6 years, 2 months ago (2014-10-02 07:47:34 UTC) #11
Elliot Glaysher
OK, this is now ready for a wider audience. Please focus more on the C++ ...
6 years, 2 months ago (2014-10-02 19:54:04 UTC) #13
yzshen1
First part of comments. Thanks! https://codereview.chromium.org/611633002/diff/100001/mojo/public/cpp/bindings/lib/map_internal.h File mojo/public/cpp/bindings/lib/map_internal.h (right): https://codereview.chromium.org/611633002/diff/100001/mojo/public/cpp/bindings/lib/map_internal.h#newcode18 mojo/public/cpp/bindings/lib/map_internal.h:18: MOJO_COMPILE_ASSERT(!internal::IsMoveOnlyType<Key>::value, (optional) you can ...
6 years, 2 months ago (2014-10-03 18:03:38 UTC) #14
yzshen1
One more comment: I think the current patch hasn't dealt with the serialization/etc. work for ...
6 years, 2 months ago (2014-10-03 18:13:48 UTC) #15
Elliot Glaysher
> I think the current patch hasn't dealt with the serialization/etc. work for Array<Map<X, Y>>. ...
6 years, 2 months ago (2014-10-03 21:11:49 UTC) #16
yzshen1
>> I think the current patch hasn't dealt with the serialization/etc. work for >> Array<Map<X, ...
6 years, 2 months ago (2014-10-06 07:41:53 UTC) #17
Elliot Glaysher
So I played around with your patch on top of mine. As a first pass, ...
6 years, 2 months ago (2014-10-06 22:34:36 UTC) #18
yzshen1
On 2014/10/06 22:34:36, Elliot Glaysher wrote: > So I played around with your patch on ...
6 years, 2 months ago (2014-10-06 23:05:06 UTC) #19
Elliot Glaysher
PTAL This switches the implementation over to a struct with two array members, as discussed ...
6 years, 2 months ago (2014-10-08 00:18:42 UTC) #20
viettrungluu
https://codereview.chromium.org/611633002/diff/240001/mojo/edk/mojo_edk.gyp File mojo/edk/mojo_edk.gyp (right): https://codereview.chromium.org/611633002/diff/240001/mojo/edk/mojo_edk.gyp#newcode89 mojo/edk/mojo_edk.gyp:89: '../public/cpp/bindings/tests/interface_ptr_unittest.cc', ?!? https://codereview.chromium.org/611633002/diff/240001/mojo/public/cpp/bindings/lib/map_data_internal.h File mojo/public/cpp/bindings/lib/map_data_internal.h (right): https://codereview.chromium.org/611633002/diff/240001/mojo/public/cpp/bindings/lib/map_data_internal.h#newcode31 mojo/public/cpp/bindings/lib/map_data_internal.h:31: nit: ...
6 years, 2 months ago (2014-10-08 16:21:56 UTC) #21
Elliot Glaysher
https://codereview.chromium.org/611633002/diff/240001/mojo/edk/mojo_edk.gyp File mojo/edk/mojo_edk.gyp (right): https://codereview.chromium.org/611633002/diff/240001/mojo/edk/mojo_edk.gyp#newcode89 mojo/edk/mojo_edk.gyp:89: '../public/cpp/bindings/tests/interface_ptr_unittest.cc', On 2014/10/08 16:21:56, viettrungluu wrote: > ?!? ITT ...
6 years, 2 months ago (2014-10-08 18:20:51 UTC) #22
viettrungluu
https://codereview.chromium.org/611633002/diff/240001/mojo/public/tools/bindings/pylib/mojom/parse/translate.py File mojo/public/tools/bindings/pylib/mojom/parse/translate.py (right): https://codereview.chromium.org/611633002/diff/240001/mojo/public/tools/bindings/pylib/mojom/parse/translate.py#newcode21 mojo/public/tools/bindings/pylib/mojom/parse/translate.py:21: def MapKind(kind): On 2014/10/08 18:20:51, Elliot Glaysher wrote: > ...
6 years, 2 months ago (2014-10-08 18:22:51 UTC) #23
Elliot Glaysher
https://codereview.chromium.org/611633002/diff/240001/mojo/public/tools/bindings/pylib/mojom/parse/translate.py File mojo/public/tools/bindings/pylib/mojom/parse/translate.py (right): https://codereview.chromium.org/611633002/diff/240001/mojo/public/tools/bindings/pylib/mojom/parse/translate.py#newcode21 mojo/public/tools/bindings/pylib/mojom/parse/translate.py:21: def MapKind(kind): On 2014/10/08 18:22:51, viettrungluu wrote: > On ...
6 years, 2 months ago (2014-10-08 19:24:46 UTC) #24
yzshen1
https://codereview.chromium.org/611633002/diff/280001/mojo/public/cpp/bindings/BUILD.gn File mojo/public/cpp/bindings/BUILD.gn (right): https://codereview.chromium.org/611633002/diff/280001/mojo/public/cpp/bindings/BUILD.gn#newcode9 mojo/public/cpp/bindings/BUILD.gn:9: "interface_ptr.h", map.h? https://codereview.chromium.org/611633002/diff/280001/mojo/public/cpp/bindings/lib/map_data_internal.h File mojo/public/cpp/bindings/lib/map_data_internal.h (right): https://codereview.chromium.org/611633002/diff/280001/mojo/public/cpp/bindings/lib/map_data_internal.h#newcode24 mojo/public/cpp/bindings/lib/map_data_internal.h:24: struct ...
6 years, 2 months ago (2014-10-08 21:58:33 UTC) #25
yzshen1
And about adding conformance tests: it is fine if you would like to do it ...
6 years, 2 months ago (2014-10-08 22:00:27 UTC) #26
Elliot Glaysher
Addressed Yuzhu's comments. I plan on doing the conformance tests in the next patch. https://codereview.chromium.org/611633002/diff/280001/mojo/public/cpp/bindings/lib/map_data_internal.h ...
6 years, 2 months ago (2014-10-08 23:40:50 UTC) #27
yzshen1
Hi, Darin. Would you please take a look at this comment that I made about ...
6 years, 2 months ago (2014-10-09 17:41:58 UTC) #29
Elliot Glaysher
PTAL This patch removes usage of the feature in the clipboard. I'll commit that as ...
6 years, 2 months ago (2014-10-09 19:15:20 UTC) #30
viettrungluu
https://codereview.chromium.org/611633002/diff/1140001/mojo/public/cpp/bindings/string.h File mojo/public/cpp/bindings/string.h (right): https://codereview.chromium.org/611633002/diff/1140001/mojo/public/cpp/bindings/string.h#newcode128 mojo/public/cpp/bindings/string.h:128: // The null string is less than a non-NULL ...
6 years, 2 months ago (2014-10-09 22:22:35 UTC) #31
yzshen1
LGTM with one last comment. Thanks for all the great work! https://codereview.chromium.org/611633002/diff/1140001/mojo/public/cpp/bindings/tests/map_unittest.cc File mojo/public/cpp/bindings/tests/map_unittest.cc (right): ...
6 years, 2 months ago (2014-10-09 22:24:41 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/611633002/1530001
6 years, 2 months ago (2014-10-09 22:53:08 UTC) #34
commit-bot: I haz the power
Committed patchset #20 (id:1530001)
6 years, 2 months ago (2014-10-10 00:12:50 UTC) #35
commit-bot: I haz the power
6 years, 2 months ago (2014-10-10 00:13:40 UTC) #36
Message was sent while issue was closed.
Patchset 20 (id:??) landed as
https://crrev.com/0f8647ec517acc9e80b0529fdb91fbd759ce85c3
Cr-Commit-Position: refs/heads/master@{#299017}

Powered by Google App Engine
This is Rietveld 408576698