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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2568403002: [Bindings][Refactoring] Remove attribute filters from .tmpl files (Closed)
Patch Set: Created 4 years 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 {% endif %} 306 {% endif %}
307 {% endblock %} 307 {% endblock %}
308 {##############################################################################} 308 {##############################################################################}
309 } // namespace {{cpp_class_or_partial}}V8Internal 309 } // namespace {{cpp_class_or_partial}}V8Internal
310 310
311 {% block visit_dom_wrapper %}{% endblock %} 311 {% block visit_dom_wrapper %}{% endblock %}
312 {##############################################################################} 312 {##############################################################################}
313 {% block install_attributes %} 313 {% block install_attributes %}
314 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 314 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
315 {% if attributes | has_attribute_configuration %} 315 {% if data_attributes %}
316 // Suppress warning: global constructors, because AttributeConfiguration is triv ial 316 // Suppress warning: global constructors, because AttributeConfiguration is triv ial
317 // and does not depend on another global objects. 317 // and does not depend on another global objects.
318 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 318 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
319 #pragma clang diagnostic push 319 #pragma clang diagnostic push
320 #pragma clang diagnostic ignored "-Wglobal-constructors" 320 #pragma clang diagnostic ignored "-Wglobal-constructors"
321 #endif 321 #endif
322 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { 322 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
323 {% for attribute in attributes | has_attribute_configuration %} 323 {% for data_attribute in data_attributes %}
324 {{attribute_configuration(attribute)}}, 324 {{attribute_configuration(data_attribute)}},
325 {% endfor %} 325 {% endfor %}
326 }; 326 };
327 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 327 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
328 #pragma clang diagnostic pop 328 #pragma clang diagnostic pop
329 #endif 329 #endif
330 330
331 {% endif %} 331 {% endif %}
332 {% endblock %} 332 {% endblock %}
333 {##############################################################################} 333 {##############################################################################}
334 {% block install_lazy_data_attributes %} 334 {% block install_lazy_data_attributes %}
335 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 335 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
336 {% if attributes | has_lazy_data_attribute_configuration %} 336 {% if lazy_data_attributes %}
337 // Suppress warning: global constructors, because AttributeConfiguration is triv ial 337 // Suppress warning: global constructors, because AttributeConfiguration is triv ial
338 // and does not depend on another global objects. 338 // and does not depend on another global objects.
339 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 339 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
340 #pragma clang diagnostic push 340 #pragma clang diagnostic push
341 #pragma clang diagnostic ignored "-Wglobal-constructors" 341 #pragma clang diagnostic ignored "-Wglobal-constructors"
342 #endif 342 #endif
343 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}LazyDataAttributes[ ] = { 343 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}LazyDataAttributes[ ] = {
344 {% for attribute in attributes | has_lazy_data_attribute_configuration %} 344 {% for data_attribute in lazy_data_attributes %}
345 {{attribute_configuration(attribute)}}, 345 {{attribute_configuration(data_attribute)}},
346 {% endfor %} 346 {% endfor %}
347 }; 347 };
348 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 348 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
349 #pragma clang diagnostic pop 349 #pragma clang diagnostic pop
350 #endif 350 #endif
351 351
352 {% endif %} 352 {% endif %}
353 {% endblock %} 353 {% endblock %}
354 {##############################################################################} 354 {##############################################################################}
355 {% block install_accessors %} 355 {% block install_accessors %}
356 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 356 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
357 {% if attributes | has_accessor_configuration %} 357 {% if accessors %}
358 const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { 358 const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
359 {% for attribute in attributes | has_accessor_configuration %} 359 {% for accessor in accessors %}
360 {{attribute_configuration(attribute)}}, 360 {{attribute_configuration(accessor)}},
361 {% endfor %} 361 {% endfor %}
362 }; 362 };
363 363
364 {% endif %} 364 {% endif %}
365 {% endblock %} 365 {% endblock %}
366 {##############################################################################} 366 {##############################################################################}
367 {% block install_methods %} 367 {% block install_methods %}
368 {% from 'methods.cpp.tmpl' import method_configuration with context %} 368 {% from 'methods.cpp.tmpl' import method_configuration with context %}
369 {% if methods | has_method_configuration(is_partial) %} 369 {% if methods | has_method_configuration(is_partial) %}
370 const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = { 370 const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 {% if is_global %} 426 {% if is_global %}
427 // Global objects are Immutable Prototype Exotic Objects 427 // Global objects are Immutable Prototype Exotic Objects
428 instanceTemplate->SetImmutableProto(); 428 instanceTemplate->SetImmutableProto();
429 {% endif %} 429 {% endif %}
430 430
431 // Register DOM constants, attributes and operations. 431 // Register DOM constants, attributes and operations.
432 {% filter runtime_enabled(runtime_enabled_function) %} 432 {% filter runtime_enabled(runtime_enabled_function) %}
433 {% if constants %} 433 {% if constants %}
434 {{install_constants() | indent(2)}} 434 {{install_constants() | indent(2)}}
435 {% endif %} 435 {% endif %}
436 {% if attributes | has_attribute_configuration %} 436 {% if data_attributes %}
437 V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, protot ypeTemplate, {{'%sAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class}}); 437 V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, protot ypeTemplate, {{'%sAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class}});
438 {% endif %} 438 {% endif %}
439 {% if attributes | has_lazy_data_attribute_configuration %} 439 {% if lazy_data_attributes %}
440 V8DOMConfiguration::installLazyDataAttributes(isolate, world, instanceTemplate , prototypeTemplate, {{'%sLazyDataAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH( %sLazyDataAttributes)' % v8_class}}); 440 V8DOMConfiguration::installLazyDataAttributes(isolate, world, instanceTemplate , prototypeTemplate, {{'%sLazyDataAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH( %sLazyDataAttributes)' % v8_class}});
441 {% endif %} 441 {% endif %}
442 {% if attributes | has_accessor_configuration %} 442 {% if accessors %}
443 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototy peTemplate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF_A RRAY_LENGTH(%sAccessors)' % v8_class}}); 443 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototy peTemplate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF_A RRAY_LENGTH(%sAccessors)' % v8_class}});
444 {% endif %} 444 {% endif %}
445 {% if methods | has_method_configuration(is_partial) %} 445 {% if methods | has_method_configuration(is_partial) %}
446 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototype Template, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARRAY _LENGTH(%sMethods)' % v8_class}}); 446 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototype Template, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARRAY _LENGTH(%sMethods)' % v8_class}});
447 {% endif %} 447 {% endif %}
448 {% endfilter %} 448 {% endfilter %}
449 449
450 {% if has_access_check_callbacks and not is_partial %} 450 {% if has_access_check_callbacks and not is_partial %}
451 // Cross-origin access check 451 // Cross-origin access check
452 {% set cross_origin_named_getter = '%sV8Internal::crossOriginNamedGetter' % cp p_class if has_cross_origin_named_getter else 'nullptr' %} 452 {% set cross_origin_named_getter = '%sV8Internal::crossOriginNamedGetter' % cp p_class if has_cross_origin_named_getter else 'nullptr' %}
453 {% set cross_origin_named_setter = '%sV8Internal::crossOriginNamedSetter' % cp p_class if has_cross_origin_named_setter else 'nullptr' %} 453 {% set cross_origin_named_setter = '%sV8Internal::crossOriginNamedSetter' % cp p_class if has_cross_origin_named_setter else 'nullptr' %}
454 {% set cross_origin_named_enumerator = '%sV8Internal::crossOriginNamedEnumerat or' % cpp_class if has_cross_origin_named_enumerator else 'nullptr' %} 454 {% set cross_origin_named_enumerator = '%sV8Internal::crossOriginNamedEnumerat or' % cpp_class if has_cross_origin_named_enumerator else 'nullptr' %}
455 {% set cross_origin_indexed_getter = '%sV8Internal::crossOriginIndexedGetter' % cpp_class if has_cross_origin_indexed_getter else 'nullptr' %} 455 {% set cross_origin_indexed_getter = '%sV8Internal::crossOriginIndexedGetter' % cpp_class if has_cross_origin_indexed_getter else 'nullptr' %}
456 instanceTemplate->SetAccessCheckCallbackAndHandler({{cpp_class}}V8Internal::se curityCheck, v8::NamedPropertyHandlerConfiguration({{cross_origin_named_getter}} , {{cross_origin_named_setter}}, nullptr, nullptr, {{cross_origin_named_enumerat or}}), v8::IndexedPropertyHandlerConfiguration({{cross_origin_indexed_getter}}), v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperT ypeInfo))); 456 instanceTemplate->SetAccessCheckCallbackAndHandler({{cpp_class}}V8Internal::se curityCheck, v8::NamedPropertyHandlerConfiguration({{cross_origin_named_getter}} , {{cross_origin_named_setter}}, nullptr, nullptr, {{cross_origin_named_enumerat or}}), v8::IndexedPropertyHandlerConfiguration({{cross_origin_indexed_getter}}), v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperT ypeInfo)));
457 {% endif %} 457 {% endif %}
458 458
459 {% for group in attributes | purely_runtime_enabled_attributes | groupby('runt ime_feature_name') %} 459 {% for group in runtime_enabled_attributes | groupby('runtime_feature_name') % }
460 if ({{group.list[0].runtime_enabled_function}}()) { 460 if ({{group.list[0].runtime_enabled_function}}()) {
461 {% for attribute in group.list | unique_by('name') | sort %} 461 {% for attribute in group.list | unique_by('name') | sort %}
462 {% if attribute.is_data_type_property %} 462 {% if attribute.is_data_type_property %}
463 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = {{attribute_configuration(attribute)}}; 463 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = {{attribute_configuration(attribute)}};
464 V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, proto typeTemplate, attribute{{attribute.name}}Configuration); 464 V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, proto typeTemplate, attribute{{attribute.name}}Configuration);
465 {% else %} 465 {% else %}
466 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}}; 466 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}};
467 V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, protot ypeTemplate, interfaceTemplate, signature, accessor{{attribute.name}}Configurati on); 467 V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, protot ypeTemplate, interfaceTemplate, signature, accessor{{attribute.name}}Configurati on);
468 {% endif %} 468 {% endif %}
469 {% endfor %} 469 {% endfor %}
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 596 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
597 {{attribute_getter_implemented_in_private_script(attribute)}} 597 {{attribute_getter_implemented_in_private_script(attribute)}}
598 {% if attribute.has_setter %} 598 {% if attribute.has_setter %}
599 {{attribute_setter_implemented_in_private_script(attribute)}} 599 {{attribute_setter_implemented_in_private_script(attribute)}}
600 {% endif %} 600 {% endif %}
601 {% endfor %} 601 {% endfor %}
602 {% block partial_interface %}{% endblock %} 602 {% block partial_interface %}{% endblock %}
603 } // namespace blink 603 } // namespace blink
604 604
605 {% endfilter %}{# format_blink_cpp_source_code #} 605 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698