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

Unified Diff: third_party/WebKit/Source/bindings/templates/api_experiment.cpp

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/templates/api_experiment.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/api_experiment.cpp b/third_party/WebKit/Source/bindings/templates/api_experiment.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fbbfb86f7f68da26b5f74db77f7db26c02671abc
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/templates/api_experiment.cpp
@@ -0,0 +1,15 @@
+{% macro check_api_experiment_internal(errorName, experiment_name) %}
haraken 2015/12/30 00:25:32 Could you move this macro to conversions.cpp (and
Daniel Nishi 2015/12/30 22:05:50 Done.
+{% if experiment_name %}
+String {{errorName}};
+if (!{{experiment_name}}(currentExecutionContext(info.GetIsolate()), {{errorName}})) {
+ v8SetReturnValue(info, v8::Undefined(info.GetIsolate()));
+ Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
haraken 2015/12/30 00:25:32 Avoid calling currentExecutionContext twice.
Daniel Nishi 2015/12/30 22:05:50 Done.
+ document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, {{errorName}}));
+ return;
+}
+{% endif %}
+{% endmacro %}
+{% macro check_api_experiment(member) %}
+{{check_api_experiment_internal("errorMessage", member.api_experiment_inherited_enabled)}}
+{{check_api_experiment_internal("memberErrorMessage", member.api_experiment_enabled)}}
+{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698