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

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 1322533002: bindings: Supports to change the method location. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed review comments. Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/templates/conversions.cpp ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block indexed_property_getter %} 5 {% block indexed_property_getter %}
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
7 {% set getter = indexed_property_getter %} 7 {% set getter = indexed_property_getter %}
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
9 { 9 {
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 {{v8_class}}::constructorCustom(info); 605 {{v8_class}}::constructorCustom(info);
606 {% else %} 606 {% else %}
607 {{cpp_class}}V8Internal::constructor(info); 607 {{cpp_class}}V8Internal::constructor(info);
608 {% endif %} 608 {% endif %}
609 } 609 }
610 610
611 {% endif %} 611 {% endif %}
612 {% endblock %} 612 {% endblock %}
613 613
614 614
615 {######################################} 615 {##############################################################################}
616 {% macro install_do_not_check_security_signature(method, world_suffix) %} 616 {% macro install_do_not_check_security_method(method, world_suffix, instance_tem plate, prototype_template) %}
617 {% from 'conversions.cpp' import property_location %}
617 {# Methods that are [DoNotCheckSecurity] are always readable, but if they are 618 {# Methods that are [DoNotCheckSecurity] are always readable, but if they are
618 changed and then accessed from a different origin, we do not return the 619 changed and then accessed from a different origin, we do not return the
619 underlying value, but instead return a new copy of the original function. 620 underlying value, but instead return a new copy of the original function.
620 This is achieved by storing the changed value as a hidden property. #} 621 This is achieved by storing the changed value as a hidden property. #}
621 {% set getter_callback = 622 {% set getter_callback =
622 '%sV8Internal::%sOriginSafeMethodGetterCallback%s' % 623 '%sV8Internal::%sOriginSafeMethodGetterCallback%s' %
623 (cpp_class, method.name, world_suffix) %} 624 (cpp_class, method.name, world_suffix) %}
624 {% set setter_callback = 625 {% set setter_callback =
625 '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class) 626 '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class)
626 if not method.is_read_only else '0' %} 627 if not method.is_read_only else '0' %}
627 {% if method.is_per_world_bindings %} 628 {% if method.is_per_world_bindings %}
628 {% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %} 629 {% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %}
629 {% set setter_callback_for_main_world = '%sForMainWorld' % setter_callback 630 {% set setter_callback_for_main_world = '%sForMainWorld' % setter_callback
630 if not method.is_read_only else '0' %} 631 if not method.is_read_only else '0' %}
631 {% else %} 632 {% else %}
632 {% set getter_callback_for_main_world = '0' %} 633 {% set getter_callback_for_main_world = '0' %}
633 {% set setter_callback_for_main_world = '0' %} 634 {% set setter_callback_for_main_world = '0' %}
634 {% endif %} 635 {% endif %}
635 {% set property_attribute = 636 {% set property_attribute =
636 'static_cast<v8::PropertyAttribute>(%s)' % 637 'static_cast<v8::PropertyAttribute>(%s)' %
637 ' | '.join(method.property_attributes or ['v8::DontDelete']) %} 638 ' | '.join(method.property_attributes or ['v8::DontDelete']) %}
638 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} 639 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %}
640 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' if method.is_do_not _check_signature else 'V8DOMConfiguration::CheckHolder' %}
639 const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSafeAttrib uteConfiguration = { 641 const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSafeAttrib uteConfiguration = {
640 "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callba ck_for_main_world}}, {{setter_callback_for_main_world}}, &{{v8_class}}::wrapperT ypeInfo, v8::ALL_CAN_READ, {{property_attribute}}, {{only_exposed_to_private_scr ipt}}, V8DOMConfiguration::OnInstance, 642 "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callba ck_for_main_world}}, {{setter_callback_for_main_world}}, &{{v8_class}}::wrapperT ypeInfo, v8::ALL_CAN_READ, {{property_attribute}}, {{only_exposed_to_private_scr ipt}}, {{property_location(method)}}, {{holder_check}},
641 }; 643 };
642 V8DOMConfiguration::installAttribute(isolate, {{method.function_template}}, v8:: Local<v8::ObjectTemplate>(), {{method.name}}OriginSafeAttributeConfiguration); 644 V8DOMConfiguration::installAttribute(isolate, {{instance_template}}, {{prototype _template}}, {{method.name}}OriginSafeAttributeConfiguration);
643 {%- endmacro %} 645 {%- endmacro %}
644 646
645 647
646 {##############################################################################} 648 {##############################################################################}
647 {% block get_dom_template %} 649 {% block get_dom_template %}
648 {% if not is_array_buffer_or_view %} 650 {% if not is_array_buffer_or_view %}
649 v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) 651 v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate)
650 { 652 {
651 {% if has_partial_interface %} 653 {% if has_partial_interface %}
652 {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class , v8_class) %} 654 {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class , v8_class) %}
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 } 898 }
897 899
898 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 900 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
899 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 901 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
900 { 902 {
901 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 903 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
902 } 904 }
903 {% endfor %} 905 {% endfor %}
904 {% endif %} 906 {% endif %}
905 {% endblock %} 907 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/conversions.cpp ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698