Possible to at least partially automate generation of code for Mojo typemaps? |
||||
Issue descriptionFrom primiano@: "[I'v had to] review and maintain some extremely mechanical (and error-prone) code like memory_instrumentation_struct_traits.cc. Here's the question: could we have a tools/generate_struct_traits which takes the base class, takes the mojo file and generates the struct traits file which we then check-in. It would be perfectly find to have to run the tool manually, this at least would remove the burden of reviewing and being careful when editing the code."
,
May 30 2017
> the actual mapping between the custom type and the mojom type is not that mechanical Uh I thought that: - The struct being traitsed have to have at least the same fields of the mojom equivalent (and I think it's safe to assume the field names are the same). - The fields are either pods (which have a direct mapping to mojo and hence their marshaling/unmarhaling is deterministic) or have to be recursively struct trait-ed At least this has been the case for my code above. Out of curiosity what doesn't obey to this pattern?
,
May 30 2017
#2: ... or Mojo array/map which have a 1:1 mapping with std::vector std::map
,
May 30 2017
RE #2: Almost all traits do custom validation during deserialization. And it is not uncommon that mapping between custom / mojom struct fields are more complex than what is described in #2. A simple example: https://cs.chromium.org/chromium/src/url/mojo/url_gurl_struct_traits.h A complex example: https://cs.chromium.org/chromium/src/cc/ipc/quads_struct_traits.h (And many others.)
,
May 31 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 17
,
Dec 4
It doesn't look like the effort/gain ratio is high enough since individual traits vary in subtle ways.
,
Dec 5
I meant gain/effort :-) |
||||
►
Sign in to add a comment |
||||
Comment 1 by yzshen@chromium.org
, May 30 2017Owner: ----
Status: Available (was: Assigned)