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

Side by Side 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 unified diff | Download patch
OLDNEW
1 {% include 'copyright_block.txt' %} 1 {% include 'copyright_block.txt' %}
2 #include "{{v8_class_or_partial}}.h" 2 #include "{{v8_class_or_partial}}.h"
3 3
4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
5 #include "{{filename}}" 5 #include "{{filename}}"
6 {% endfor %} 6 {% endfor %}
7 7
8 namespace blink { 8 namespace blink {
9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class 9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class
10 if active_scriptwrappable else '0' %} 10 if active_scriptwrappable else '0' %}
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 {% endfilter %} 358 {% endfilter %}
359 {% endfor %} 359 {% endfor %}
360 {% endif %} 360 {% endif %}
361 } 361 }
362 362
363 {% endif %}{# not is_array_buffer_or_view #} 363 {% endif %}{# not is_array_buffer_or_view #}
364 {% endblock %} 364 {% endblock %}
365 {##############################################################################} 365 {##############################################################################}
366 {% block origin_trials %} 366 {% block origin_trials %}
367 {% from 'attributes.cpp' import attribute_configuration with context %} 367 {% from 'attributes.cpp' import attribute_configuration with context %}
368 {% for group in attributes|origin_trial_enabled_attributes|groupby('origin_trial _feature_name') %}{{newline}} 368 {% from 'constants.cpp' import constant_configuration with context %}
369 void {{v8_class_or_partial}}::install{{group.grouper}}(ScriptState* scriptState, v8::Local<v8::Object> instance) 369 {% for origin_trial_feature_name in origin_trial_feature_names %}{{newline}}
370 void {{v8_class_or_partial}}::install{{origin_trial_feature_name}}(ScriptState* scriptState, v8::Local<v8::Object> instance)
370 { 371 {
371 v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptS tate->isolate()); 372 v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptS tate->isolate());
372 v8::Local<v8::Signature> signature; 373 v8::Local<v8::Signature> signature;
373 ALLOW_UNUSED_LOCAL(signature); 374 ALLOW_UNUSED_LOCAL(signature);
374 {% for attribute in group.list | unique_by('name') | sort %} 375 {% for attribute in attributes|for_feature(origin_trial_feature_name) | uniq ue_by('name') | sort %}
375 {% if attribute.is_data_type_property %} 376 {% if attribute.is_data_type_property %}
376 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \ 377 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \
377 {{attribute_configuration(attribute)}}; 378 {{attribute_configuration(attribute)}};
378 V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->wo rld(), instance, prototype, attribute{{attribute.name}}Configuration); 379 V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->wo rld(), instance, prototype, attribute{{attribute.name}}Configuration);
379 {% else %} 380 {% else %}
380 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \ 381 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \
381 {{attribute_configuration(attribute)}}; 382 {{attribute_configuration(attribute)}};
382 V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->wor ld(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attri bute.name}}Configuration); 383 V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->wor ld(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attri bute.name}}Configuration);
383 {% endif %} 384 {% endif %}
384 {% endfor %} 385 {% endfor %}
386
387 {# 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 :)
388 {% for constant in constants | for_feature(origin_trial_feature_name) | uniq ue_by('name') | sort %}
389 {% set constant_name = constant.name.title().replace('_', '') %}
390 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Con figuration = {{constant_configuration(constant)}};
391 V8DOMConfiguration::installConstant(scriptState->isolate(), scriptState->wor ld(), prototype, constant{{constant_name}}Configuration);
392 {% endfor %}
385 } 393 }
386 {% endfor %} 394 {% endfor %}
387 {% endblock %} 395 {% endblock %}
388 {##############################################################################} 396 {##############################################################################}
389 {% block get_dom_template %}{% endblock %} 397 {% block get_dom_template %}{% endblock %}
390 {% block get_dom_template_for_named_properties_object %}{% endblock %} 398 {% block get_dom_template_for_named_properties_object %}{% endblock %}
391 {% block has_instance %}{% endblock %} 399 {% block has_instance %}{% endblock %}
392 {% block to_impl %}{% endblock %} 400 {% block to_impl %}{% endblock %}
393 {% block to_impl_with_type_check %}{% endblock %} 401 {% block to_impl_with_type_check %}{% endblock %}
394 {% block install_conditional_attributes %}{% endblock %} 402 {% block install_conditional_attributes %}{% endblock %}
395 {##############################################################################} 403 {##############################################################################}
396 {% block prepare_prototype_and_interface_object %}{% endblock %} 404 {% block prepare_prototype_and_interface_object %}{% endblock %}
397 {##############################################################################} 405 {##############################################################################}
398 {% block to_active_scriptwrappable %}{% endblock %} 406 {% block to_active_scriptwrappable %}{% endblock %}
399 {% for method in methods if method.is_implemented_in_private_script and method.v isible %} 407 {% for method in methods if method.is_implemented_in_private_script and method.v isible %}
400 {{method_implemented_in_private_script(method)}} 408 {{method_implemented_in_private_script(method)}}
401 {% endfor %} 409 {% endfor %}
402 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 410 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
403 {{attribute_getter_implemented_in_private_script(attribute)}} 411 {{attribute_getter_implemented_in_private_script(attribute)}}
404 {% if attribute.has_setter %} 412 {% if attribute.has_setter %}
405 {{attribute_setter_implemented_in_private_script(attribute)}} 413 {{attribute_setter_implemented_in_private_script(attribute)}}
406 {% endif %} 414 {% endif %}
407 {% endfor %} 415 {% endfor %}
408 {% block partial_interface %}{% endblock %} 416 {% block partial_interface %}{% endblock %}
409 } // namespace blink 417 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698