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

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: Less hacky and less lines. 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..348b26eb36233a518a1e77384b358418acf1dcf1 100644
--- a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
+++ b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
@@ -401,6 +401,7 @@ def initialize_jinja_env(cache_dir):
'conditional': conditional_if_endif,
'exposed': exposed_if,
'runtime_enabled': runtime_enabled_if,
+ 'api_experiment_enabled': api_experiment_enabled_if,
})
return jinja_env
@@ -437,6 +438,16 @@ 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 main(argv):

Powered by Google App Engine
This is Rietveld 408576698