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

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

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/templates/utilities.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/utilities.cpp b/third_party/WebKit/Source/bindings/templates/utilities.cpp
index 7f759451c7be673f3470fc20b7b8469cf318a546..63944aebe62a64eae260ffd55d89595cab73c5e6 100644
--- a/third_party/WebKit/Source/bindings/templates/utilities.cpp
+++ b/third_party/WebKit/Source/bindings/templates/utilities.cpp
@@ -53,3 +53,22 @@ const char* validValues[] = {
{% endif %}
{{property_location_list | join(' | ')}}
{%- endmacro %}
+
+
+{% macro check_api_experiment_internal(errorName, experiment_name) %}
+{% if experiment_name %}
+String {{errorName}};
+if (!{{experiment_name}}(executionContext, {{errorName}})) {
+ v8SetReturnValue(info, v8::Undefined(info.GetIsolate()));
+ toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, {{errorName}}));
+ return;
+}
+{% endif %}
+{% endmacro %}
+
+
+{% macro check_api_experiment(member, isolate="info.GetIsolate()") -%}
+ExecutionContext* executionContext = currentExecutionContext({{isolate}});
+{{check_api_experiment_internal("errorMessage", member.api_experiment_enabled_per_interface) -}}
+{{check_api_experiment_internal("memberErrorMessage", member.api_experiment_enabled) -}}
+{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698