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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove 'return undefined and print a message' on constructors. 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/code_generator_v8.py
diff --git a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
index 110e8e86368557bf0d9baeb3df52de50ff09503d..b058c33854adced2f156ef5b772d4a857a608763 100644
--- a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
+++ b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
@@ -397,8 +397,10 @@ def initialize_jinja_env(cache_dir):
lstrip_blocks=True, # so can indent control flow tags
trim_blocks=True)
jinja_env.filters.update({
+ 'api_experiment_enabled': api_experiment_enabled_if,
'blink_capitalize': capitalize,
'conditional': conditional_if_endif,
+ 'experimental_framework_runtime_enabled': experimental_framework_runtime_enabled_if,
'exposed': exposed_if,
'runtime_enabled': runtime_enabled_if,
})
@@ -437,6 +439,22 @@ def runtime_enabled_if(code, runtime_enabled_function_name):
return generate_indented_conditional(code, '%s()' % runtime_enabled_function_name)
+# [APIExperimentEnabled]
+def api_experiment_enabled_if(code, api_experiment_name, error_message=None):
+ if not api_experiment_name:
+ return code
+ if error_message:
+ conditional = 'Experiments::isApiEnabled(currentExecutionContext(isolate), "%s", %s)' % (api_experiment_name, error_message)
+ else:
+ conditional = 'Experiments::isApiEnabledWithoutMessage(currentExecutionContext(isolate), "%s")' % api_experiment_name
+ return generate_indented_conditional(code, conditional)
+
+
+def experimental_framework_runtime_enabled_if(code, api_experiment_name):
+ if not api_experiment_name:
+ return code
+ return generate_indented_conditional(code, "RuntimeEnabledFeatures::experimentalFrameworkEnabled()")
+
################################################################################
def main(argv):

Powered by Google App Engine
This is Rietveld 408576698