New issue
Advanced search Search tips

Issue 698440 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature

Blocked on:
issue 839389


Participants' hotlists:
Hotlist-Bindings-IDLCompiler


Sign in to add a comment

Bindings code should not rely on Jinja2 context objects for information-passing

Project Member Reported by dglazkov@chromium.org, Mar 4 2017

Issue description

Currently, the Jinja2 context objects, such as method_context, overloads_context, et al. are used both as the Jinja2 template context objects and as means of passing information/context during bindings generation.

For example, method_context holds on an IdlType (which is not used by Jinja2).

This conflation of responsibilities leads to code that's difficult to maintain.

For example, there's currently an obvious bug in https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/scripts/v8_interface.py?rcl=0f799230c0f27e3e8882868f46d9d5cefe9c8c6d&l=774, since overloads_context is called both for methods (that do have a name) and constructors (that don't), but I wasn't able to easily reason out a fix.

Another code smell is just above on line 772, where we are using any() to determine whether methods have origin trial features. This is typically an indication that this information was available at one time, but then was lost and has to be reconstructed. In an ideal world, some context/builder object would hold on to this data and it would need to be grafter onto or extracted by inspection out of the Jinja2 context object.

However, there's a definite cost to this new ideal world. I gave it a shot this week, and realized it's a fairly large project that probably needs more than a 5% contributor investment.

At the same time, I am optimistic. Now that we have unit tests, we can actually start making these changes safely.

 
Cc: yukishiino@chromium.org peria@chromium.org bashi@chromium.org
Owner: yukishiino@chromium.org
bashi, yukishiino, peria: This is something we should handle in the binding team.

Comment 2 by peria@chromium.org, Mar 8 2017

Status: Available (was: Untriaged)
Yes, we would like to work for the issue, and I think it a part of re-design of code generation.
Let's discuss it in our meetings.

Owner: peria@chromium.org
Status: Assigned (was: Available)

Comment 4 by peria@chromium.org, May 3 2018

Blockedon: 839389

Comment 5 by peria@chromium.org, May 25 2018

Labels: Hotlist-Bindings-IDLCompiler

Sign in to add a comment