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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Install interfaces/attributes/methods unconditionally. Use the generated ExperimentalFeature functi… Created 5 years 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_utilities.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
index cb770bb9492051f5897afb10dd0e83c8c1c585f9..ab36011c4b4ad102faab070c84aeaadf9d562af1 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
@@ -380,6 +380,29 @@ def measure_as(definition_or_member, interface):
return None
+def runtime_feature_name(definition_or_member):
+ extended_attributes = definition_or_member.extended_attributes
+ if 'RuntimeEnabled' not in extended_attributes:
+ return None
+ return extended_attributes['RuntimeEnabled']
+
+
+def is_api_experiment_enabled(interface):
haraken 2015/12/30 00:25:32 interface => definition_or_member ?
Daniel Nishi 2015/12/30 22:05:50 Done.
+ return 'APIExperimentEnabled' in interface.extended_attributes
+
+
+def api_experiment_name(interface):
+ return interface.extended_attributes['APIExperimentEnabled'] if is_api_experiment_enabled(interface) else None
+
+
+def api_experiment_enabled_function(definition_or_member):
+ experiment_name = api_experiment_name(definition_or_member)
+ feature_name = runtime_feature_name(definition_or_member)
+ if not feature_name or not experiment_name:
haraken 2015/12/30 00:25:32 Why do we need to check 'not feature_name'? Aren't
Daniel Nishi 2015/12/30 22:05:50 https://codereview.chromium.org/1538663003/ uses t
+ return
+ return 'ExperimentalFeatures::%sEnabled' % uncapitalize(feature_name)
+
+
# [RuntimeEnabled]
def runtime_enabled_function_name(definition_or_member):
"""Returns the name of the RuntimeEnabledFeatures function.
@@ -388,10 +411,16 @@ def runtime_enabled_function_name(definition_or_member):
Given extended attribute RuntimeEnabled=FeatureName, return:
RuntimeEnabledFeatures::{featureName}Enabled
"""
- extended_attributes = definition_or_member.extended_attributes
- if 'RuntimeEnabled' not in extended_attributes:
- return None
- feature_name = extended_attributes['RuntimeEnabled']
+ feature_name = runtime_feature_name(definition_or_member)
+
+ # If an experiment is on the method/attribute, it overrides the runtime
haraken 2015/12/30 00:25:32 experiment => API experiment ("experiment" sounds
Daniel Nishi 2015/12/30 22:05:50 Done.
+ # enabled status. For now, we are unconditionally installing experimental
+ # attributes/methods, so we are acting as though the runtime enabled
+ # function doesn't exist. (It is checked in the generated
+ # ExperimentalFeatures function, instead)
+ experiment_name = api_experiment_name(definition_or_member)
+ if not feature_name or experiment_name:
+ return
return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)

Powered by Google App Engine
This is Rietveld 408576698