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

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

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Fix comments, Re-apply v8 enumerable/configurable/rw attributes to descriptor Created 4 years, 7 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 abd7ca3320ecfc0a6755172837a200020ebe2a8a..adedcb304019b5f64999385797f4e12c87a75931 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
@@ -365,6 +365,35 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% endif %}{# not is_array_buffer_or_view #}
{% endblock %}
{##############################################################################}
+{% 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)
+{
+ v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptState->isolate());
+ {% for attribute in group.list | unique_by('name') | sort %}
+ {% if attribute.is_data_type_property %}
+ const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->world(), instance, prototype, attribute{{attribute.name}}Configuration);
Yuki 2016/05/31 05:05:32 Note for the binding team: We may want to rename i
+ {% else %}
+ v8::Local<v8::Signature> signature;
+ // This parameter is required for installAccessor, to install static
+ // attributes on existing interfaces. This is not currently supported in
+ // origin trials, and this parameter is unused by installAccessor. (An
+ // assertion in the bindings generation code ensures this.)
+ // TODO(iclelland): Replace this with the actual interface, to allow origin
+ // trials on static attributes. (crbug.com/614352)
Yuki 2016/05/31 05:05:32 I don't understand this comment. Are you trying t
iclelland 2016/05/31 05:34:52 No.
+ v8::Local<v8::Function> interface = v8::Function::New(scriptState->context(), nullptr).ToLocalChecked();
+ const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = \
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, interface, signature, accessor{{attribute.name}}Configuration);
+ {% endif %}
+ {% endfor %}
+}
+{% endfor %}
+{% endblock %}
+{##############################################################################}
{% block get_dom_template %}{% endblock %}
{% block get_dom_template_for_named_properties_object %}{% endblock %}
{% block has_instance %}{% endblock %}

Powered by Google App Engine
This is Rietveld 408576698