Index: third_party/WebKit/Source/bindings/scripts/v8_interface.py |
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_interface.py |
index 1f7ab537dcb7f25dd709670ea9d73499d1966d62..996d2377821782e25b48ff3a3ab5a5f0b89fff99 100644 |
--- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py |
+++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py |
@@ -107,25 +107,29 @@ def origin_trial_features(interface, constants, attributes, methods): |
to be installed on every instance of the interface. This list is the union |
of the sets of features used for constants, attributes and methods. |
""" |
+ key = 'origin_trial_feature_name' |
# Collect all members visible on this interface with a defined origin trial |
- origin_trial_members = ( |
- [constant for constant in constants if constant['origin_trial_feature_name']] + |
- [attribute for attribute in attributes if attribute['origin_trial_feature_name']] + |
- [method for method in methods if ( |
- v8_methods.method_is_visible(method, interface.is_partial) and |
- method['origin_trial_feature_name'])] |
- ) |
- # Group members by origin_trial_feature_name |
- members_by_name = itertools.groupby(sorted(origin_trial_members, |
- key=itemgetter('origin_trial_feature_name')), |
- itemgetter('origin_trial_feature_name')) |
+ origin_trial_constants = [constant for constant in constants if constant[key]] |
+ origin_trial_attributes = [attribute for attribute in attributes if attribute[key]] |
+ origin_trial_methods = [method for method in methods if ( |
+ v8_methods.method_is_visible(method, interface.is_partial) and method[key])] |
+ |
+ feature_names = set([constant[key] for constant in origin_trial_constants] + |
+ [attribute[key] for attribute in origin_trial_attributes] + |
+ [method[key] for method in origin_trial_methods]) |
+ |
# Construct the list of dictionaries. 'needs_instance' will be true if any |
# member for the feature has 'on_instance' defined as true. |
features = [{'name': name, |
- 'needs_instance': reduce(or_, (member.get('on_instance', False) |
- for member in members))} |
- for name, members in members_by_name] |
+ 'constants': [constant for constant in origin_trial_constants if constant[key] == name], |
+ 'attributes': [attribute for attribute in origin_trial_attributes if attribute[key] == name], |
+ 'methods': [method for method in origin_trial_methods if method[key] == name]} |
+ for name in feature_names] |
+ for feature in features: |
+ members = feature['constants'] + feature['attributes'] + feature['methods'] |
+ feature['needs_instance'] = reduce(or_, (member.get('on_instance', False) for member in members)) |
+ |
if features: |
includes.add('bindings/core/v8/ScriptState.h') |
includes.add('core/origin_trials/OriginTrials.h') |