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

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: Addressing comments. Created 4 years, 12 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_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..151e1891495e27bf37c67bed300395cdb28f96e8 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(definition_or_member):
+ return 'APIExperimentEnabled' in definition_or_member.extended_attributes
+
+
+def api_experiment_name(definition_or_member):
+ return definition_or_member.extended_attributes['APIExperimentEnabled'] if is_api_experiment_enabled(definition_or_member) 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:
+ 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 API experiment is on the method/attribute, it overrides the runtime
+ # 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)
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/v8_methods.py ('k') | third_party/WebKit/Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698