New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 727557 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 727551



Sign in to add a comment

Possible to at least partially automate generation of code for Mojo typemaps?

Project Member Reported by blundell@chromium.org, May 30 2017

Issue description

From 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."
 

Comment 1 by yzshen@chromium.org, May 30 2017

Cc: yzshen@chromium.org
Owner: ----
Status: Available (was: Assigned)
Although it would be convenient, I don't think it is realistic to come up with an automatic tool for the majority case.
In most cases, the actual mapping between the custom type and the mojom type is not that mechanical.

Is it the most tedious case where a custom enum and a mojom enum have exactly the same values that is bothering you? :) That seems an easier problem to solve.


> 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?
#2: ... or Mojo array/map which have a 1:1 mapping with std::vector std::map

Comment 4 by yzshen@chromium.org, 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.)


Project Member

Comment 5 by sheriffbot@chromium.org, May 31 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
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
Cc: -roc...@chromium.org rockot@google.com
Labels: -Hotlist-Recharge-Cold
Status: WontFix (was: Untriaged)
It doesn't look like the effort/gain ratio is high enough since individual traits vary in subtle ways.
I meant gain/effort :-)

Sign in to add a comment