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

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

Issue 2057273002: [OriginTrials] Support OriginTrialEnabled IDL attribute on constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/interface_base.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
index 7e559ae43d0eb6d0757b276e027fb41cf0a6ff5f..406a2b83510d0c063c1bdcfd701aa4c1776c51fd 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
@@ -365,13 +365,14 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{##############################################################################}
{% block origin_trials %}
{% from 'attributes.cpp' import attribute_configuration with context %}
-{% for group in attributes|origin_trial_enabled_attributes|groupby('origin_trial_feature_name') %}{{newline}}
-void {{v8_class_or_partial}}::install{{group.grouper}}(ScriptState* scriptState, v8::Local<v8::Object> instance)
+{% from 'constants.cpp' import constant_configuration with context %}
+{% for origin_trial_feature_name in origin_trial_feature_names %}{{newline}}
+void {{v8_class_or_partial}}::install{{origin_trial_feature_name}}(ScriptState* scriptState, v8::Local<v8::Object> instance)
{
v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptState->isolate());
v8::Local<v8::Signature> signature;
ALLOW_UNUSED_LOCAL(signature);
- {% for attribute in group.list | unique_by('name') | sort %}
+ {% for attribute in attributes|for_feature(origin_trial_feature_name) | unique_by('name') | sort %}
{% if attribute.is_data_type_property %}
const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \
{{attribute_configuration(attribute)}};
@@ -382,6 +383,13 @@ void {{v8_class_or_partial}}::install{{group.grouper}}(ScriptState* scriptState,
V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attribute.name}}Configuration);
{% endif %}
{% endfor %}
+
+ {# Runtime-enabled constants #}
chasej 2016/06/10 20:09:30 Should this be origin trial enabled constants?
iclelland 2016/06/10 20:24:01 Yes. Yes it should. Thanks :)
+ {% for constant in constants | for_feature(origin_trial_feature_name) | unique_by('name') | sort %}
+ {% set constant_name = constant.name.title().replace('_', '') %}
+ const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configuration = {{constant_configuration(constant)}};
+ V8DOMConfiguration::installConstant(scriptState->isolate(), scriptState->world(), prototype, constant{{constant_name}}Configuration);
+ {% endfor %}
}
{% endfor %}
{% endblock %}

Powered by Google App Engine
This is Rietveld 408576698