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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2622153002: [Bindings] Implement installRuntimeEnabledFeatures method on some classes (Closed)
Patch Set: Work for comments Created 3 years, 11 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 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
4 #include "{{v8_class_or_partial}}.h" 4 #include "{{v8_class_or_partial}}.h"
5 5
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 {% endif %} 520 {% endif %}
521 {% endfilter %} 521 {% endfilter %}
522 {% endfilter %} 522 {% endfilter %}
523 {% endfor %} 523 {% endfor %}
524 {% endif %} 524 {% endif %}
525 } 525 }
526 526
527 {% endif %}{# not is_array_buffer_or_view #} 527 {% endif %}{# not is_array_buffer_or_view #}
528 {% endblock %} 528 {% endblock %}
529 {##############################################################################} 529 {##############################################################################}
530 {% block install_runtime_enabled %}
531 {% if needs_runtime_enabled_installer %}
532 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
533 {% from 'methods.cpp.tmpl' import install_custom_signature with context %}
534 void {{v8_class_or_partial}}::installRuntimeEnabledFeatures(v8::Isolate* isolate , const DOMWrapperWorld& world, v8::Local<v8::Object> instance, v8::Local<v8::Ob ject> prototype, v8::Local<v8::Function> interface, v8::Local<v8::FunctionTempla te> interfaceTemplate) {
haraken 2017/01/11 12:16:13 As discussed offline, simply drop the |interfaceTe
peria 2017/01/11 12:41:16 Done. In case if we implement installRuntimeEnable
535 {% if runtime_enabled_feature_name %}
536 #error "We don't expect a runtime enabled interface {{v8_class_or_partial}} to h ave installRuntimeEnabledFeatures()."
537 {% endif %}
538
539 {% if is_partial %}
540 {{v8_class}}::installRuntimeEnabledFeatures(isolate, world, instance, prototyp e, interface, interfaceTemplate);
541 {% endif %}
542
543 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
544 ALLOW_UNUSED_LOCAL(signature);
545
546 {# TODO(peria): Generate code to install constants. It depends on runtime_enab led_feaure of this interface. #}
547
548 {% for feature_name, attrs in runtime_enabled_attributes | groupby('runtime_en abled_feature_name') %}
549 {% filter runtime_enabled(feature_name) %}
550 {% for attribute in attrs | unique_by('name') | sort %}
551 {% if attribute.is_data_type_property %}
552 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}};
553 V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attr ibute{{attribute.name}}Configuration);
554 {% else %}
555 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf iguration = {{attribute_configuration(attribute)}};
556 V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, inter face, signature, accessor{{attribute.name}}Configuration);
557 {% endif %}
558 {% endfor %}
559 {% endfilter %}
560 {% endfor %}
561
562 {% if iterator_method and iterator_method.runtime_enabled_feature_name %}
563 {% filter exposed(iterator_method.exposed_test) %}
564 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %}
565 // Runtime enabled iterator (@@iterator)
566 #error "We don't expect {{v8_class_or_partial}} to have runtime enabled iterator s."
567 {% endfilter %}
568 {% endfilter %}
569 {% endif %}
570
571 {% if methods | custom_registration(is_partial) %}
572 {% for method in methods | custom_registration(is_partial) %}
573 {% filter exposed(method.overloads.exposed_test_all
574 if method.overloads else method.exposed_test) %}
575 {% set feature_name = (method.overloads.runtime_enabled_all
576 if method.overloads else method.runtime_enabled_feature _name) %}
577 {% if feature_name %}
578 {% filter runtime_enabled(feature_name) %}
579 {% if method.is_cross_origin %}
580 // Runtime enabled cross origin methods
581 NOTREACHED();
Yuki 2017/01/11 11:30:58 You may want to replace this with #error, too.
peria 2017/01/11 12:41:16 Done.
582 {% else %}
583 {{install_custom_signature(method, 'instance', 'prototype', 'interface', 'sign ature') | indent(2)}}
584 {% endif %}
585 {% endfilter %}
586 {% endif %}
587 {% endfilter %}
588 {% endfor %}
589 {% endif %}
590 }
591
592 {% endif %}{# needs_runtime_enabled_installer #}
593 {% endblock %}
594 {##############################################################################}
530 {% block origin_trials %} 595 {% block origin_trials %}
531 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 596 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
532 {% from 'constants.cpp.tmpl' import constant_configuration with context %} 597 {% from 'constants.cpp.tmpl' import constant_configuration with context %}
533 {% from 'methods.cpp.tmpl' import method_configuration with context %} 598 {% from 'methods.cpp.tmpl' import method_configuration with context %}
534 {% for feature in origin_trial_features %} 599 {% for feature in origin_trial_features %}
535 void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons t DOMWrapperWorld& world, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface) { 600 void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons t DOMWrapperWorld& world, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface) {
536 {% if feature.attributes or feature.methods %} 601 {% if feature.attributes or feature.methods %}
537 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world); 602 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world);
538 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late); 603 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
539 ALLOW_UNUSED_LOCAL(signature); 604 ALLOW_UNUSED_LOCAL(signature);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 {% block has_instance %}{% endblock %} 649 {% block has_instance %}{% endblock %}
585 {% block to_impl %}{% endblock %} 650 {% block to_impl %}{% endblock %}
586 {% block to_impl_with_type_check %}{% endblock %} 651 {% block to_impl_with_type_check %}{% endblock %}
587 {##############################################################################} 652 {##############################################################################}
588 {% block prepare_prototype_and_interface_object %}{% endblock %} 653 {% block prepare_prototype_and_interface_object %}{% endblock %}
589 {##############################################################################} 654 {##############################################################################}
590 {% block partial_interface %}{% endblock %} 655 {% block partial_interface %}{% endblock %}
591 } // namespace blink 656 } // namespace blink
592 657
593 {% endfilter %}{# format_blink_cpp_source_code #} 658 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698