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

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: Addressing comments from PS#2 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..25e85241bf65d7aa0860bb1c68a900212058c7cd 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
@@ -365,13 +365,13 @@ 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 %}
+ {# Origin-Trial-enabled attributes #}
+ {% for attribute in attributes | for_origin_trial_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)}};
@@ -379,9 +379,18 @@ void {{v8_class_or_partial}}::install{{group.grouper}}(ScriptState* scriptState,
{% else %}
const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = \
{{attribute_configuration(attribute)}};
+ v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeInfo.domTemplate(scriptState->isolate(), scriptState->world());
Yuki 2016/06/16 08:01:08 I'm very sorry, I should have recommended the foll
iclelland 2016/06/16 22:55:37 I'm happy to switch it to this way. Thanks, Yuki!
+ v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate(), interfaceTemplate);
V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attribute.name}}Configuration);
{% endif %}
{% endfor %}
+
+ {# Origin-Trial-enabled constants #}
+ {% for constant in constants | for_origin_trial_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(), prototype, constant{{constant_name}}Configuration, &{{v8_class}}::wrapperTypeInfo);
+ {% endfor %}
}
{% endfor %}
{% endblock %}

Powered by Google App Engine
This is Rietveld 408576698