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

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: Fix build error 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) {
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);
541 {% endif %}
542
543 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world);
544 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
545 ALLOW_UNUSED_LOCAL(signature);
546
547 {# TODO(peria): Generate code to install constants. It depends on runtime_enab led_feaure of this interface. #}
548
549 {% for feature_name, attrs in runtime_enabled_attributes | groupby('runtime_en abled_feature_name') %}
550 {% filter runtime_enabled(feature_name) %}
551 {% for attribute in attrs | unique_by('name') | sort %}
552 {% if attribute.is_data_type_property %}
553 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}};
554 V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attr ibute{{attribute.name}}Configuration);
555 {% else %}
556 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf iguration = {{attribute_configuration(attribute)}};
557 V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, inter face, signature, accessor{{attribute.name}}Configuration);
558 {% endif %}
559 {% endfor %}
560 {% endfilter %}
561 {% endfor %}
562
563 {% if iterator_method and iterator_method.runtime_enabled_feature_name %}
564 {% filter exposed(iterator_method.exposed_test) %}
565 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %}
566 // Runtime enabled iterator (@@iterator)
567 #error "{{v8_class_or_partial}} should not have runtime enabled iterators."
568 {% endfilter %}
569 {% endfilter %}
570 {% endif %}
571
572 {% if methods | custom_registration(is_partial) %}
573 {% for method in methods | custom_registration(is_partial) %}
574 {% filter exposed(method.overloads.exposed_test_all
575 if method.overloads else method.exposed_test) %}
576 {% set feature_name = (method.overloads.runtime_enabled_all
577 if method.overloads else method.runtime_enabled_feature _name) %}
578 {% if feature_name %}
579 {% filter runtime_enabled(feature_name) %}
580 {% if method.is_cross_origin %}
581 #error "{{v8_class_or_partial}} should not have runtime enabled and cross origin methods."
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