Replace usage of WTF::HashMap with base::flat_map in mojo |
|||
Issue descriptionWe would ultimately like to remove the Hash method generated for Mojo C++ bindings (https://crbug.com/911929), but it looks like the Blink bindings use WTF::HashMap, which depends on the generated Hash method. If the Blink bindings use flat_map instead, we could completely remove the generated Hash method.
,
Dec 11
,
Dec 11
Does it require Blink to completely replace WTF::HashMap in the code base with flat_map? (which is not realistic because WTF::HashMap is integrated with Blink GC's infrastructure)
,
Dec 11
No definitely not, just generated Mojo bindings in Blink would use flat_map wherever mojom maps are needed.
,
Dec 11
Thanks. Then who is responsible for converting the flat_map to WTF::HashMap when the mojo message is passed to Blink? If the conversion is encapsulated in the auto-generated mojo bindings, I'm happy with it :)
,
Dec 11
Sorry, the issue is specifically when someone wants to use a mojom map where a (non-typemapped) mojom struct is the key type. If we generate code which uses HashMap to represent the map, then we must also generate hashing code for every mojom struct (we can't know at generation time whether or not any given struct will definitely be used as a map key somewhere, so we'd have to generate it just in case). The point of the blocked bug is that we would like to stop generating hashing code altogether, so that would mean never generating code which uses HashMap in these cases. And for consistency I think that would in turn mean never generating code which uses HashMap for any cases. This would mean callers who want to pass a HashMap to a mojom call in blink would have to explicitly convert, and implementations of mojom interfaces would receive a flat_map and have to manually convert to HashMap.
,
Dec 12
How would that conversion code look like? If it's just one helper function, I think it will be acceptable. |
|||
►
Sign in to add a comment |
|||
Comment 1 by rockot@google.com
, Dec 11