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

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: More sharing. 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..f13e0d1c307828f8170e912e6ce911a52119b668 100644
--- a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
+++ b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
@@ -399,6 +399,7 @@ def initialize_jinja_env(cache_dir):
jinja_env.filters.update({
'blink_capitalize': capitalize,
'conditional': conditional_if_endif,
+ 'experimental_framework_runtime_enabled': experimental_framework_runtime_enabled_if,
'exposed': exposed_if,
'runtime_enabled': runtime_enabled_if,
})
@@ -423,19 +424,23 @@ def conditional_if_endif(code, conditional_string):
'#endif // %s\n' % conditional_string)
+def maybe_add_conditional(code, test, conditional):
+ if not test:
+ return code
+ return generate_indented_conditional(code, conditional)
+
# [Exposed]
def exposed_if(code, exposed_test):
- if not exposed_test:
- return code
- return generate_indented_conditional(code, 'executionContext && (%s)' % exposed_test)
+ return maybe_add_conditional(code, exposed_test, 'executionContext && (%s)' % exposed_test)
# [RuntimeEnabled]
def runtime_enabled_if(code, runtime_enabled_function_name):
- if not runtime_enabled_function_name:
- return code
- return generate_indented_conditional(code, '%s()' % runtime_enabled_function_name)
+ return maybe_add_conditional(code, runtime_enabled_function_name, '%s' % runtime_enabled_function_name)
+
+def experimental_framework_runtime_enabled_if(code, api_experiment_name):
+ return maybe_add_conditional(code, api_experiment_name, "RuntimeEnabledFeatures::experimentalFrameworkEnabled()")
################################################################################

Powered by Google App Engine
This is Rietveld 408576698