Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 2057273002: [OriginTrials] Support OriginTrialEnabled IDL attribute on constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move signature creation out of for loop Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 733588872c047fb115d9a3169c1d50d3d161d377..bdcaef5704adba77e4032639987fcfc9eb4d3102 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
@@ -78,8 +78,7 @@ def filter_has_constant_configuration(constants):
def filter_has_special_getter(constants):
return [constant for constant in constants if
constant['measure_as'] or
- constant['deprecate_as'] or
- constant['origin_trial_enabled_function']]
+ constant['deprecate_as']]
def filter_runtime_enabled(constants):
@@ -87,10 +86,29 @@ def filter_runtime_enabled(constants):
constant['runtime_enabled_function']]
+def filter_origin_trial_enabled(constants):
+ return [constant for constant in constants if
+ constant['origin_trial_feature_name']]
+
+
def constant_filters():
return {'has_constant_configuration': filter_has_constant_configuration,
'has_special_getter': filter_has_special_getter,
- 'runtime_enabled_constants': filter_runtime_enabled}
+ 'runtime_enabled_constants': filter_runtime_enabled,
+ 'origin_trial_enabled_constants': filter_origin_trial_enabled}
+
+
+def origin_trial_feature_names(constants, attributes):
+ """ Returns a list of the names of each origin trial feature used in this interface.
+
+ This list is the union of the sets of names used for constants and attributes.
+ """
+
+ feature_names = set(
+ [constant['origin_trial_feature_name'] for constant in constants if constant['origin_trial_feature_name']] +
+ [attribute['origin_trial_feature_name'] for attribute in attributes if attribute['origin_trial_feature_name']]
+ )
+ return sorted(feature_names)
def interface_context(interface):
@@ -586,6 +604,10 @@ def interface_context(interface):
'has_named_properties_object': is_global and context['named_property_getter'],
})
+ # Origin Trials
+ context.update({
+ 'origin_trial_feature_names': origin_trial_feature_names(context['constants'], context['attributes']),
+ })
return context

Powered by Google App Engine
This is Rietveld 408576698