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

Issue 2339413004: Allow Mojo structs as map keys (Closed)

Created:
4 years, 3 months ago by tibell
Modified:
4 years, 2 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Allow Mojo structs as map keys * The hash function is not resilient to hash flooding (but neither is the other hash functions we already use for e.g. unordered_containers). * Add std::hash and WTF::DefaultHash/HashTraits traits for {Inlined}StructPtr. * Modify the generated Struct/UnionTraits so they generate const accessors to the struct/union fields where possible (i.e. when there are not handle fields). Committed: https://crrev.com/96a67c55783156f1b32a3915fcb54038d556e30f Cr-Commit-Position: refs/heads/master@{#420578}

Patch Set 1 #

Patch Set 2 : Add tests #

Patch Set 3 : Add blink mojom dependency #

Patch Set 4 : Minor clean-ups #

Patch Set 5 : Deal with type-mapped structs #

Patch Set 6 : Override std::hash inside the right namespace #

Patch Set 7 : Address GCC syntax strictness #

Patch Set 8 : Remove left-over import #

Total comments: 55

Patch Set 9 : Address review comments #

Patch Set 10 : Revert no-longer-needed changes to clone_equals_util.h #

Total comments: 21

Patch Set 11 : Address all review comments #

Total comments: 12

Patch Set 12 : Address sammc's comments and improve Blink tests #

Total comments: 21

Patch Set 13 : Address yzshen@'s review comments #

Patch Set 14 : Add more tests for hashing #

Patch Set 15 : Add comment about deleted values #

Patch Set 16 : Fix merge problem in BUILD.gn file #

Total comments: 2

Patch Set 17 : Remove a blank line #

Patch Set 18 : Fix hash unit test on Windows #

Unified diffs Side-by-side diffs Delta from patch set Stats (+871 lines, -705 lines) Patch
M components/font_service/public/cpp/font_service_thread.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M mojo/android/javatests/src/org/chromium/mojo/bindings/ValidationTest.java View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -1 line 0 comments Download
M mojo/public/cpp/bindings/BUILD.gn View 1 2 3 4 5 6 7 8 2 chunks +2 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 2 chunks +5 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/hash_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +73 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/native_struct.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +6 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/wtf_hash_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +132 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/map_traits.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -6 lines 0 comments Download
M mojo/public/cpp/bindings/map_traits_stl.h View 1 1 chunk +4 lines, -8 lines 0 comments Download
M mojo/public/cpp/bindings/map_traits_wtf_hash_map.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -11 lines 0 comments Download
M mojo/public/cpp/bindings/native_struct.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/cpp/bindings/string.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +13 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/struct_ptr.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 6 chunks +122 lines, -34 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 3 chunks +3 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/hash_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +47 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/map_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +44 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/rect_blink.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +19 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/rect_blink.typemap View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/cpp/bindings/tests/rect_chromium.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +19 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/rect_chromium.typemap View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
A mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +48 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/wtf_map_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +46 lines, -0 lines 0 comments Download
A + mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.data View 1 2 3 4 5 6 7 8 9 10 0 chunks +-1 lines, --1 lines 0 comments Download
A + mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_exceed_recursion_limit.expected View 1 2 3 4 5 6 7 8 9 10 0 chunks +-1 lines, --1 lines 0 comments Download
D mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_good.data View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -612 lines 0 comments Download
D mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd19_good.expected View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -1 line 0 comments Download
A mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.data View 1 2 3 4 5 6 7 8 9 10 1 chunk +57 lines, -0 lines 0 comments Download
A + mojo/public/interfaces/bindings/tests/data/validation/conformance_mthd20_good.expected View 1 0 chunks +-1 lines, --1 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/test_structs.mojom View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +16 lines, -0 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/js/validation_unittests.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generate_type_mappings.py View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl View 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_traits_declaration.tmpl View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +9 lines, -3 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/union_traits_declaration.tmpl View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -11 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl View 1 chunk +4 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 7 8 9 10 11 1 chunk +13 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_declaration.tmpl View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_definition.tmpl View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +20 lines, -0 lines 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 10 chunks +85 lines, -12 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 3 chunks +50 lines, -5 lines 0 comments Download

Messages

Total messages: 109 (72 generated)
tibell
Add tests
4 years, 3 months ago (2016-09-19 23:17:02 UTC) #1
tibell
Add blink mojom dependency
4 years, 3 months ago (2016-09-19 23:52:55 UTC) #7
tibell
Minor clean-ups
4 years, 3 months ago (2016-09-20 00:45:16 UTC) #13
tibell
Deal with type-mapped structs
4 years, 3 months ago (2016-09-20 04:57:22 UTC) #18
tibell
Override std::hash inside the right namespace
4 years, 3 months ago (2016-09-20 05:33:13 UTC) #23
tibell
Address GCC syntax strictness
4 years, 3 months ago (2016-09-20 05:58:26 UTC) #28
tibell
Remove left-over import
4 years, 3 months ago (2016-09-20 06:30:39 UTC) #33
tibell
This is now ready for a first review. I'm still adding some more tests.
4 years, 3 months ago (2016-09-20 07:14:35 UTC) #38
yzshen1
It mostly looks good. This is nice work. :) https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/lib/clone_equals_util.h File mojo/public/cpp/bindings/lib/clone_equals_util.h (right): https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/lib/clone_equals_util.h#newcode160 mojo/public/cpp/bindings/lib/clone_equals_util.h:160: ...
4 years, 3 months ago (2016-09-20 23:44:40 UTC) #41
Sam McNally
https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/lib/clone_equals_util.h File mojo/public/cpp/bindings/lib/clone_equals_util.h (right): https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/lib/clone_equals_util.h#newcode197 mojo/public/cpp/bindings/lib/clone_equals_util.h:197: struct HashTraits<base::Optional<T>, false> { If we're still disallowing nullable ...
4 years, 3 months ago (2016-09-21 04:57:58 UTC) #42
tibell
Address review comments
4 years, 3 months ago (2016-09-21 07:08:33 UTC) #43
tibell
+erg@ for: components/font_service/public/cpp/font_service_thread.cc I have to comments left to address, but I'm replying to the ...
4 years, 3 months ago (2016-09-21 07:10:54 UTC) #47
tibell
Revert no-longer-needed changes to clone_equals_util.h
4 years, 3 months ago (2016-09-21 07:17:31 UTC) #48
Elliot Glaysher
lgtm with nit https://codereview.chromium.org/2339413004/diff/180001/components/font_service/public/cpp/font_service_thread.cc File components/font_service/public/cpp/font_service_thread.cc (right): https://codereview.chromium.org/2339413004/diff/180001/components/font_service/public/cpp/font_service_thread.cc#newcode127 components/font_service/public/cpp/font_service_thread.cc:127: *out_valid = bool(font_identity); nit: font_identity.is_bound() This ...
4 years, 2 months ago (2016-09-21 17:27:30 UTC) #53
yzshen1
A few more comments. Thanks! https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/struct_ptr.h File mojo/public/cpp/bindings/struct_ptr.h (right): https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/struct_ptr.h#newcode91 mojo/public/cpp/bindings/struct_ptr.h:91: bool isHashTableDeletedValue() const { ...
4 years, 2 months ago (2016-09-21 23:17:53 UTC) #54
tibell
Address all review comments
4 years, 2 months ago (2016-09-22 05:16:19 UTC) #55
tibell
PTAL I've addressed all comments now. The decltype stuff is now much simpler. https://codereview.chromium.org/2339413004/diff/140001/mojo/public/cpp/bindings/struct_ptr.h File ...
4 years, 2 months ago (2016-09-22 05:17:23 UTC) #58
Sam McNally
https://codereview.chromium.org/2339413004/diff/200001/mojo/public/cpp/bindings/lib/wtf_hash_util.h File mojo/public/cpp/bindings/lib/wtf_hash_util.h (right): https://codereview.chromium.org/2339413004/diff/200001/mojo/public/cpp/bindings/lib/wtf_hash_util.h#newcode70 mojo/public/cpp/bindings/lib/wtf_hash_util.h:70: return mojo::internal::StructPtrWTFHelper<T>::ConstructDeletedValue(value); Wat? https://codereview.chromium.org/2339413004/diff/200001/mojo/public/cpp/bindings/lib/wtf_hash_util.h#newcode90 mojo/public/cpp/bindings/lib/wtf_hash_util.h:90: return mojo::internal::InlinedStructPtrWTFHelper<T>::ConstructDeletedValue( Ditto. https://codereview.chromium.org/2339413004/diff/200001/mojo/public/cpp/bindings/string.h ...
4 years, 2 months ago (2016-09-22 05:40:52 UTC) #61
tibell
Address sammc's comments and improve Blink tests
4 years, 2 months ago (2016-09-22 07:18:05 UTC) #62
tibell
PTAL https://codereview.chromium.org/2339413004/diff/200001/mojo/public/cpp/bindings/lib/wtf_hash_util.h File mojo/public/cpp/bindings/lib/wtf_hash_util.h (right): https://codereview.chromium.org/2339413004/diff/200001/mojo/public/cpp/bindings/lib/wtf_hash_util.h#newcode70 mojo/public/cpp/bindings/lib/wtf_hash_util.h:70: return mojo::internal::StructPtrWTFHelper<T>::ConstructDeletedValue(value); On 2016/09/22 05:40:51, Sam McNally wrote: ...
4 years, 2 months ago (2016-09-22 07:18:34 UTC) #65
tibell
https://codereview.chromium.org/2339413004/diff/220001/mojo/public/cpp/bindings/lib/wtf_hash_util.h File mojo/public/cpp/bindings/lib/wtf_hash_util.h (right): https://codereview.chromium.org/2339413004/diff/220001/mojo/public/cpp/bindings/lib/wtf_hash_util.h#newcode31 mojo/public/cpp/bindings/lib/wtf_hash_util.h:31: struct WTFHashTraits; This trait exists separately from HashTraits so ...
4 years, 2 months ago (2016-09-22 07:30:26 UTC) #66
yzshen1
https://codereview.chromium.org/2339413004/diff/180001/mojo/public/cpp/bindings/struct_ptr.h File mojo/public/cpp/bindings/struct_ptr.h (right): https://codereview.chromium.org/2339413004/diff/180001/mojo/public/cpp/bindings/struct_ptr.h#newcode214 mojo/public/cpp/bindings/struct_ptr.h:214: new (&slot) InlinedStructPtr(); On 2016/09/22 05:17:23, tibell wrote: > ...
4 years, 2 months ago (2016-09-22 23:48:57 UTC) #69
tibell
Address yzshen@'s review comments
4 years, 2 months ago (2016-09-23 00:04:50 UTC) #70
tibell
PTAL https://codereview.chromium.org/2339413004/diff/220001/mojo/public/cpp/bindings/lib/wtf_hash_util.h File mojo/public/cpp/bindings/lib/wtf_hash_util.h (right): https://codereview.chromium.org/2339413004/diff/220001/mojo/public/cpp/bindings/lib/wtf_hash_util.h#newcode25 mojo/public/cpp/bindings/lib/wtf_hash_util.h:25: // there are no general instance for enums ...
4 years, 2 months ago (2016-09-23 00:07:08 UTC) #73
yzshen1
LGTM Thanks for the nice work! The following comment is not replied yet: > |slot| ...
4 years, 2 months ago (2016-09-23 01:08:23 UTC) #76
tibell
Add more tests for hashing
4 years, 2 months ago (2016-09-23 01:10:18 UTC) #77
tibell
Add comment about deleted values
4 years, 2 months ago (2016-09-23 01:12:11 UTC) #80
tibell
Fix merge problem in BUILD.gn file
4 years, 2 months ago (2016-09-23 01:23:33 UTC) #85
Sam McNally
lgtm https://codereview.chromium.org/2339413004/diff/300001/mojo/public/cpp/bindings/struct_ptr.h File mojo/public/cpp/bindings/struct_ptr.h (right): https://codereview.chromium.org/2339413004/diff/300001/mojo/public/cpp/bindings/struct_ptr.h#newcode278 mojo/public/cpp/bindings/struct_ptr.h:278: No blank line between namespace closing braces.
4 years, 2 months ago (2016-09-23 01:35:04 UTC) #88
tibell
Remove a blank line
4 years, 2 months ago (2016-09-23 01:39:04 UTC) #89
tibell
https://codereview.chromium.org/2339413004/diff/300001/mojo/public/cpp/bindings/struct_ptr.h File mojo/public/cpp/bindings/struct_ptr.h (right): https://codereview.chromium.org/2339413004/diff/300001/mojo/public/cpp/bindings/struct_ptr.h#newcode278 mojo/public/cpp/bindings/struct_ptr.h:278: On 2016/09/23 01:35:04, Sam McNally wrote: > No blank ...
4 years, 2 months ago (2016-09-23 01:39:35 UTC) #92
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/2339413004/320001
4 years, 2 months ago (2016-09-23 01:50:14 UTC) #96
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/284693)
4 years, 2 months ago (2016-09-23 03:37:53 UTC) #98
tibell
Fix hash unit test on Windows
4 years, 2 months ago (2016-09-23 03:44:43 UTC) #99
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/2339413004/340001
4 years, 2 months ago (2016-09-23 03:46:08 UTC) #105
commit-bot: I haz the power
Committed patchset #18 (id:340001)
4 years, 2 months ago (2016-09-23 04:48:47 UTC) #107
commit-bot: I haz the power
4 years, 2 months ago (2016-09-23 04:50:51 UTC) #109
Message was sent while issue was closed.
Patchset 18 (id:??) landed as
https://crrev.com/96a67c55783156f1b32a3915fcb54038d556e30f
Cr-Commit-Position: refs/heads/master@{#420578}

Powered by Google App Engine
This is Rietveld 408576698