Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %} | 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %} |
| 2 | 2 |
| 3 {##############################################################################} | 3 {##############################################################################} |
| 4 {% macro attribute_getter(attribute, world_suffix) %} | 4 {% macro attribute_getter(attribute, world_suffix) %} |
| 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 6 {%- if attribute.is_data_type_property %} | 6 {%- if attribute.is_data_type_property %} |
| 7 const v8::PropertyCallbackInfo<v8::Value>& info | 7 const v8::PropertyCallbackInfo<v8::Value>& info |
| 8 {%- else %} | 8 {%- else %} |
| 9 const v8::FunctionCallbackInfo<v8::Value>& info | 9 const v8::FunctionCallbackInfo<v8::Value>& info |
| 10 {%- endif %}) { | 10 {%- endif %}) { |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 {% endmacro %} | 419 {% endmacro %} |
| 420 | 420 |
| 421 | 421 |
| 422 {##############################################################################} | 422 {##############################################################################} |
| 423 {% macro attribute_configuration(attribute) %} | 423 {% macro attribute_configuration(attribute) %} |
| 424 {% from 'utilities.cpp.tmpl' import property_location %} | 424 {% from 'utilities.cpp.tmpl' import property_location %} |
| 425 {% if attribute.constructor_type %} | 425 {% if attribute.constructor_type %} |
| 426 {% set getter_callback = | 426 {% set getter_callback = |
| 427 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr ibute.name) | 427 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr ibute.name) |
| 428 if attribute.needs_constructor_getter_callback else | 428 if attribute.needs_constructor_getter_callback else |
| 429 'v8ConstructorAttributeGetter' %} | 429 ('V8%s::NamedConstructorAttributeGetter' % (attribute.constructor_type) |
| 430 if attribute.is_named_constructor else | |
| 431 'v8ConstructorAttributeGetter') %} | |
| 430 {% set setter_callback = '0' %} | 432 {% set setter_callback = '0' %} |
| 431 {% else %}{# regular attributes #} | 433 {% else %}{# regular attributes #} |
| 432 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 434 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
| 433 (cpp_class_or_partial, attribute.name) %} | 435 (cpp_class_or_partial, attribute.name) %} |
| 434 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % | 436 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % |
| 435 (cpp_class_or_partial, attribute.name) | 437 (cpp_class_or_partial, attribute.name) |
| 436 if attribute.has_setter else '0' %} | 438 if attribute.has_setter else '0' %} |
| 437 {% endif %} | 439 {% endif %} |
| 438 {% set getter_callback_for_main_world = | 440 {% set getter_callback_for_main_world = |
| 439 '%sForMainWorld' % getter_callback | 441 '%sForMainWorld' % getter_callback |
| 440 if attribute.is_per_world_bindings else '0' %} | 442 if attribute.is_per_world_bindings else '0' %} |
| 441 {% set setter_callback_for_main_world = | 443 {% set setter_callback_for_main_world = |
| 442 '%sForMainWorld' % setter_callback | 444 '%sForMainWorld' % setter_callback |
| 443 if attribute.is_per_world_bindings and attribute.has_setter else '0' %} | 445 if attribute.is_per_world_bindings and attribute.has_setter else '0' %} |
| 444 {% set wrapper_type_info = | 446 {% set wrapper_type_info = |
| 445 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % | 447 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % |
| 446 attribute.constructor_type | 448 attribute.constructor_type |
| 447 if attribute.constructor_type else '0' %} | 449 if attribute.constructor_type else '0' %} |
|
Yuki
2017/01/20 05:54:42
nit: Since you no longer need |data| in NamedConst
sashab
2017/01/25 02:34:51
Done, I think. Is this what you meant?
| |
| 448 {% if attribute.is_data_type_property %} | 450 {% if attribute.is_data_type_property %} |
| 449 {% set access_control = 'static_cast<v8::AccessControl>(%s)' % | 451 {% set access_control = 'static_cast<v8::AccessControl>(%s)' % |
| 450 ' | '.join(attribute.access_control_list) %} | 452 ' | '.join(attribute.access_control_list) %} |
| 451 {% else %} | 453 {% else %} |
| 452 {% set access_control = 'v8::DEFAULT' %} | 454 {% set access_control = 'v8::DEFAULT' %} |
| 453 {% endif %} | 455 {% endif %} |
| 454 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 456 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
| 455 ' | '.join(attribute.property_attributes) %} | 457 ' | '.join(attribute.property_attributes) %} |
| 456 {% set cached_accessor_callback = | 458 {% set cached_accessor_callback = |
| 457 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu te.name) | 459 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu te.name) |
| 458 if attribute.is_cached_accessor else | 460 if attribute.is_cached_accessor else |
| 459 'nullptr' %} | 461 'nullptr' %} |
| 460 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' | 462 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' |
| 461 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} | 463 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} |
| 462 {% set attribute_configuration_list = [ | 464 {% set attribute_configuration_list = [ |
| 463 '"%s"' % attribute.name, | 465 '"%s"' % attribute.name, |
| 464 getter_callback, | 466 getter_callback, |
| 465 setter_callback, | 467 setter_callback, |
| 466 getter_callback_for_main_world, | 468 getter_callback_for_main_world, |
| 467 setter_callback_for_main_world, | 469 setter_callback_for_main_world, |
| 468 cached_accessor_callback, | 470 cached_accessor_callback, |
| 469 wrapper_type_info, | 471 wrapper_type_info, |
| 470 access_control, | 472 access_control, |
| 471 property_attribute, | 473 property_attribute, |
| 472 property_location(attribute), | 474 property_location(attribute), |
| 473 holder_check, | 475 holder_check, |
| 474 ] %} | 476 ] %} |
| 475 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 477 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 476 {%- endmacro %} | 478 {%- endmacro %} |
| OLD | NEW |