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

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: 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
« no previous file with comments | « third_party/WebKit/Source/bindings/templates/interface.h.tmpl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 v8_class_or_partial in ['V8Window', 'V8HTMLDocument', 'V8Document', 'V8Nod e', 'V8EventTarget'] %}
Yuki 2017/01/11 07:06:52 v8_class_or_partial can be V8WindowPartial, right?
peria 2017/01/11 10:20:53 Done. Moved the logic into v8_interface.py.
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 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world);
Yuki 2017/01/11 07:06:52 You may want to take interfaceTemplate as an argum
peria 2017/01/11 10:20:52 Done.
536 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
537 ALLOW_UNUSED_LOCAL(signature);
538
Yuki 2017/01/11 07:06:52 Why don't you care about constants?
peria 2017/01/11 10:20:53 It needs updates in V8DOMConfigurations, while we
539 {% for feature_name, attrs in runtime_enabled_attributes | groupby('runtime_en abled_feature_name') %}
540 {% filter runtime_enabled(feature_name) %}
541 {% for attribute in attrs | unique_by('name') | sort %}
542 {% if attribute.is_data_type_property %}
543 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}};
544 V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attr ibute{{attribute.name}}Configuration);
545 {% else %}
546 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf iguration = {{attribute_configuration(attribute)}};
547 V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, inter face, signature, accessor{{attribute.name}}Configuration);
548 {% endif %}
549 {% endfor %}
550 {% endfilter %}
551 {% endfor %}
552
553 {% if iterator_method and iterator_method.runtime_enabled_feature_name %}
554 {% filter exposed(iterator_method.exposed_test) %}
555 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %}
556 // Runtime enabled iterator (@@iterator)
557 NOTREACHED();
558 {% endfilter %}
559 {% endfilter %}
560 {% endif %}
561
562 {% if methods | custom_registration(is_partial) %}
563 {% for method in methods | custom_registration(is_partial) %}
564 {% filter exposed(method.overloads.exposed_test_all
565 if method.overloads else method.exposed_test) %}
566 {% set feature_name = (method.overloads.runtime_enabled_all
567 if method.overloads else method.runtime_enabled_feature _name) %}
568 {% if feature_name %}
569 {% filter runtime_enabled(feature_name) %}
570 {% if method.is_cross_origin %}
571 // Runtime enabled cross origin methods
572 NOTREACHED();
573 {% else %}
574 {{install_custom_signature(method, 'instance', 'prototype', 'interface', 'sign ature') | indent(2)}}
575 {% endif %}
576 {% endfilter %}
577 {% endif %}
578 {% endfilter %}
579 {% endfor %}
580 {% endif %}
581 }
582
583 {% endif %}{# v8_class_or_partial #}
584 {% endblock %}
585 {##############################################################################}
530 {% block origin_trials %} 586 {% block origin_trials %}
531 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 587 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
532 {% from 'constants.cpp.tmpl' import constant_configuration with context %} 588 {% from 'constants.cpp.tmpl' import constant_configuration with context %}
533 {% from 'methods.cpp.tmpl' import method_configuration with context %} 589 {% from 'methods.cpp.tmpl' import method_configuration with context %}
534 {% for feature in origin_trial_features %} 590 {% 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) { 591 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 %} 592 {% if feature.attributes or feature.methods %}
537 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world); 593 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world);
538 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late); 594 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
539 ALLOW_UNUSED_LOCAL(signature); 595 ALLOW_UNUSED_LOCAL(signature);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 {% block has_instance %}{% endblock %} 640 {% block has_instance %}{% endblock %}
585 {% block to_impl %}{% endblock %} 641 {% block to_impl %}{% endblock %}
586 {% block to_impl_with_type_check %}{% endblock %} 642 {% block to_impl_with_type_check %}{% endblock %}
587 {##############################################################################} 643 {##############################################################################}
588 {% block prepare_prototype_and_interface_object %}{% endblock %} 644 {% block prepare_prototype_and_interface_object %}{% endblock %}
589 {##############################################################################} 645 {##############################################################################}
590 {% block partial_interface %}{% endblock %} 646 {% block partial_interface %}{% endblock %}
591 } // namespace blink 647 } // namespace blink
592 648
593 {% endfilter %}{# format_blink_cpp_source_code #} 649 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/templates/interface.h.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698