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

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

Issue 1181113006: bindings: Introduces on_{instance,prototype,interface} in the code generator. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l ocal_cpp_value %} 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l ocal_cpp_value %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_getter(attribute, world_suffix) %} 5 {% macro attribute_getter(attribute, world_suffix) %}
6 {% filter conditional(attribute.conditional_string) %} 6 {% filter conditional(attribute.conditional_string) %}
7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
8 {%- if attribute.is_expose_js_accessors %} 8 {%- if attribute.is_expose_js_accessors %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- else %} 10 {%- else %}
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 attribute.constructor_type 521 attribute.constructor_type
522 if attribute.constructor_type else '0' %} 522 if attribute.constructor_type else '0' %}
523 {% set access_control = 'static_cast<v8::AccessControl>(%s)' % 523 {% set access_control = 'static_cast<v8::AccessControl>(%s)' %
524 ' | '.join(attribute.access_control_list) %} 524 ' | '.join(attribute.access_control_list) %}
525 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % 525 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' %
526 ' | '.join(attribute.property_attributes) %} 526 ' | '.join(attribute.property_attributes) %}
527 {% set only_exposed_to_private_script = 527 {% set only_exposed_to_private_script =
528 'V8DOMConfiguration::OnlyExposedToPrivateScript' 528 'V8DOMConfiguration::OnlyExposedToPrivateScript'
529 if attribute.only_exposed_to_private_script else 529 if attribute.only_exposed_to_private_script else
530 'V8DOMConfiguration::ExposedToAllScripts' %} 530 'V8DOMConfiguration::ExposedToAllScripts' %}
531 {% set on_prototype = 'V8DOMConfiguration::OnPrototype' 531 {% set property_location_list = [] %}
532 if interface_name == 'Window' and attribute.idl_type == 'EventHandler' 532 {% if attribute.on_instance %}
533 else 'V8DOMConfiguration::OnInstance' %} 533 {% set property_location_list = property_location_list + ['V8DOMConfiguration::O nInstance'] %}
534 {% endif %}
535 {% if attribute.on_prototype %}
haraken 2015/06/17 16:31:21 if => elif ?
536 {% set property_location_list = property_location_list + ['V8DOMConfiguration::O nPrototype'] %}
537 {% endif %}
538 {% if attribute.on_interface %}
haraken 2015/06/17 16:31:21 if => elif ? Maybe it would be better to use attr
Yuki 2015/06/18 07:44:41 I intend to make property_location bitflags. One
539 {% set property_location_list = property_location_list + ['V8DOMConfiguration::O nInterface'] %}
540 {% endif %}
541 {% set property_location = property_location_list | join(' | ') %}
534 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' 542 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder'
535 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} 543 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %}
536 {% set attribute_configuration_list = [ 544 {% set attribute_configuration_list = [
537 '"%s"' % attribute.name, 545 '"%s"' % attribute.name,
538 getter_callback, 546 getter_callback,
539 setter_callback, 547 setter_callback,
540 getter_callback_for_main_world, 548 getter_callback_for_main_world,
541 setter_callback_for_main_world, 549 setter_callback_for_main_world,
542 wrapper_type_info, 550 wrapper_type_info,
543 access_control, 551 access_control,
544 property_attribute, 552 property_attribute,
545 only_exposed_to_private_script, 553 only_exposed_to_private_script,
554 property_location,
555 holder_check,
haraken 2015/06/17 16:31:21 alphabetical order
bashi 2015/06/18 02:16:27 These are for AttributeConfiguration struct so we
546 ] %} 556 ] %}
547 {% if attribute.is_expose_js_accessors %}
548 {% set attribute_configuration_list = attribute_configuration_list
549 + [holder_check] %}
550 {% else %}
551 {% set attribute_configuration_list = attribute_configuration_list
552 + [on_prototype] %}
553 {% endif %}
554 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 557 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
555 {%- endmacro %} 558 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698