| OLD | NEW |
| 1 {% include 'copyright_block.txt' %} | 1 {% include 'copyright_block.txt' %} |
| 2 #include "config.h" | 2 #include "config.h" |
| 3 {% filter conditional(conditional_string) %} | 3 {% filter conditional(conditional_string) %} |
| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 {% endif %} | 291 {% endif %} |
| 292 { | 292 { |
| 293 {% if is_partial %} | 293 {% if is_partial %} |
| 294 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate); | 294 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate); |
| 295 {% else %} | 295 {% else %} |
| 296 functionTemplate->ReadOnlyPrototype(); | 296 functionTemplate->ReadOnlyPrototype(); |
| 297 {% endif %} | 297 {% endif %} |
| 298 | 298 |
| 299 v8::Local<v8::Signature> defaultSignature; | 299 v8::Local<v8::Signature> defaultSignature; |
| 300 {% set parent_template = | 300 {% set parent_template = |
| 301 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class |
| 302 if has_named_properties_object else |
| 301 'V8%s::domTemplate(isolate)' % parent_interface | 303 'V8%s::domTemplate(isolate)' % parent_interface |
| 302 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} | 304 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} |
| 303 {% if runtime_enabled_function %} | 305 {% if runtime_enabled_function %} |
| 304 if (!{{runtime_enabled_function}}()) | 306 if (!{{runtime_enabled_function}}()) |
| 305 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate,
functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::inter
nalFieldCount, 0, 0, 0, 0, 0, 0); | 307 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate,
functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::inter
nalFieldCount, 0, 0, 0, 0, 0, 0); |
| 306 else | 308 else |
| 307 {% endif %} | 309 {% endif %} |
| 308 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} | 310 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} |
| 309 {% filter indent(runtime_enabled_indent, true) %} | 311 {% filter indent(runtime_enabled_indent, true) %} |
| 310 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func
tionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalF
ieldCount, | 312 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func
tionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalF
ieldCount, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 {{attribute_configuration(attribute)}}; | 362 {{attribute_configuration(attribute)}}; |
| 361 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype
Template, functionTemplate, defaultSignature, accessorConfiguration); | 363 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype
Template, functionTemplate, defaultSignature, accessorConfiguration); |
| 362 {% endif %} | 364 {% endif %} |
| 363 } | 365 } |
| 364 {% endfilter %} | 366 {% endfilter %} |
| 365 {% endfor %} | 367 {% endfor %} |
| 366 {% if constants %} | 368 {% if constants %} |
| 367 {{install_constants() | indent}} | 369 {{install_constants() | indent}} |
| 368 {% endif %} | 370 {% endif %} |
| 369 {# Special operations #} | 371 {# Special operations #} |
| 370 {# V8 has access-check callback API and it\'s used on Window instead of | |
| 371 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. | |
| 372 In addition, the getter should be set on the prototype template, to get | |
| 373 the implementation straight out of the Window prototype, regardless of | |
| 374 what prototype is actually set on the object. #} | |
| 375 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' | |
| 376 else 'InstanceTemplate' %} | |
| 377 {% if indexed_property_getter %} | 372 {% if indexed_property_getter %} |
| 378 {# if have indexed properties, MUST have an indexed property getter #} | 373 {{install_indexed_property_handler('instanceTemplate') | indent}} |
| 379 {% set indexed_property_getter_callback = | |
| 380 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} | |
| 381 {% set indexed_property_setter_callback = | |
| 382 '%sV8Internal::indexedPropertySetterCallback' % cpp_class | |
| 383 if indexed_property_setter else '0' %} | |
| 384 {% set indexed_property_query_callback = '0' %}{# Unused #} | |
| 385 {% set indexed_property_deleter_callback = | |
| 386 '%sV8Internal::indexedPropertyDeleterCallback' % cpp_class | |
| 387 if indexed_property_deleter else '0' %} | |
| 388 {% set indexed_property_enumerator_callback = | |
| 389 'indexedPropertyEnumerator<%s>' % cpp_class | |
| 390 if indexed_property_getter.is_enumerable else '0' %} | |
| 391 { | |
| 392 v8::IndexedPropertyHandlerConfiguration config({{indexed_property_getter
_callback}}, {{indexed_property_setter_callback}}, {{indexed_property_query_call
back}}, {{indexed_property_deleter_callback}}, {{indexed_property_enumerator_cal
lback}}); | |
| 393 {% if indexed_property_getter.do_not_check_security %} | |
| 394 config.flags = v8::PropertyHandlerFlags::kAllCanRead; | |
| 395 {% endif %} | |
| 396 functionTemplate->{{set_on_template}}()->SetHandler(config); | |
| 397 } | |
| 398 {% endif %} | 374 {% endif %} |
| 399 {% if named_property_getter %} | 375 {% if named_property_getter and not has_named_properties_object %} |
| 400 {# if have named properties, MUST have a named property getter #} | 376 {{install_named_property_handler('instanceTemplate') | indent}} |
| 401 {% set named_property_getter_callback = | |
| 402 '%sV8Internal::namedPropertyGetterCallback' % cpp_class %} | |
| 403 {% set named_property_setter_callback = | |
| 404 '%sV8Internal::namedPropertySetterCallback' % cpp_class | |
| 405 if named_property_setter else '0' %} | |
| 406 {% set named_property_query_callback = | |
| 407 '%sV8Internal::namedPropertyQueryCallback' % cpp_class | |
| 408 if named_property_getter.is_enumerable else '0' %} | |
| 409 {% set named_property_deleter_callback = | |
| 410 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class | |
| 411 if named_property_deleter else '0' %} | |
| 412 {% set named_property_enumerator_callback = | |
| 413 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class | |
| 414 if named_property_getter.is_enumerable else '0' %} | |
| 415 { | |
| 416 int flags = static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStr
ings); | |
| 417 {% if named_property_getter.do_not_check_security %} | |
| 418 flags |= static_cast<int>(v8::PropertyHandlerFlags::kAllCanRead); | |
| 419 {% endif %} | |
| 420 {% if not is_override_builtins %} | |
| 421 flags |= static_cast<int>(v8::PropertyHandlerFlags::kNonMasking); | |
| 422 {% endif %} | |
| 423 v8::NamedPropertyHandlerConfiguration config({{named_property_getter_cal
lback}}, {{named_property_setter_callback}}, {{named_property_query_callback}},
{{named_property_deleter_callback}}, {{named_property_enumerator_callback}}, v8:
:Handle<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(flags)); | |
| 424 functionTemplate->{{set_on_template}}()->SetHandler(config); | |
| 425 } | |
| 426 {% endif %} | 377 {% endif %} |
| 427 {% if iterator_method %} | 378 {% if iterator_method %} |
| 428 {% filter exposed(iterator_method.exposed_test) %} | 379 {% filter exposed(iterator_method.exposed_test) %} |
| 429 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %} | 380 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %} |
| 430 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator
Configuration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::i
teratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScript
s, V8DOMConfiguration::OnPrototype }; | 381 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator
Configuration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::i
teratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScript
s, V8DOMConfiguration::OnPrototype }; |
| 431 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu
re, symbolKeyedIteratorConfiguration); | 382 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu
re, symbolKeyedIteratorConfiguration); |
| 432 {% endfilter %}{# runtime_enabled() #} | 383 {% endfilter %}{# runtime_enabled() #} |
| 433 {% endfilter %}{# exposed() #} | 384 {% endfilter %}{# exposed() #} |
| 434 {% endif %} | 385 {% endif %} |
| 435 {# End special operations #} | 386 {# End special operations #} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 456 {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate',
'functionTemplate', signature) | indent}} | 407 {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate',
'functionTemplate', signature) | indent}} |
| 457 {% endif %}{# is_do_not_check_security #} | 408 {% endif %}{# is_do_not_check_security #} |
| 458 {% endfilter %}{# runtime_enabled() #} | 409 {% endfilter %}{# runtime_enabled() #} |
| 459 {% endfilter %}{# exposed() #} | 410 {% endfilter %}{# exposed() #} |
| 460 {% endfilter %}{# conditional() #} | 411 {% endfilter %}{# conditional() #} |
| 461 {% endfor %} | 412 {% endfor %} |
| 462 {# Special interfaces #} | 413 {# Special interfaces #} |
| 463 {% if not is_partial %} | 414 {% if not is_partial %} |
| 464 {% if interface_name == 'Window' %} | 415 {% if interface_name == 'Window' %} |
| 465 | 416 |
| 417 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
| 466 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 418 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
| 467 functionTemplate->SetHiddenPrototype(true); | 419 {% endif %} |
| 468 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 420 {% if is_global or interface_name == 'HTMLDocument' %} |
| 469 {% elif interface_name in [ | |
| 470 'HTMLDocument', 'DedicatedWorkerGlobalScope', 'CompositorWorkerGlobal
Scope', | |
| 471 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} | |
| 472 functionTemplate->SetHiddenPrototype(true); | 421 functionTemplate->SetHiddenPrototype(true); |
| 473 {% endif %} | 422 {% endif %} |
| 474 | 423 |
| 475 // Custom toString template | 424 // Custom toString template |
| 476 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | 425 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); |
| 477 {% endif %} | 426 {% endif %} |
| 478 } | 427 } |
| 479 | 428 |
| 480 {% endif %}{# not is_array_buffer_or_view #} | 429 {% endif %}{# not is_array_buffer_or_view #} |
| 481 {% endblock %} | 430 {% endblock %} |
| 482 {##############################################################################} | 431 {##############################################################################} |
| 483 {% block get_dom_template %}{% endblock %} | 432 {% block get_dom_template %}{% endblock %} |
| 433 {% block get_dom_template_for_named_properties_object %}{% endblock %} |
| 484 {% block has_instance %}{% endblock %} | 434 {% block has_instance %}{% endblock %} |
| 485 {% block to_impl %}{% endblock %} | 435 {% block to_impl %}{% endblock %} |
| 486 {% block to_impl_with_type_check %}{% endblock %} | 436 {% block to_impl_with_type_check %}{% endblock %} |
| 487 {% block install_conditional_attributes %}{% endblock %} | 437 {% block install_conditional_attributes %}{% endblock %} |
| 488 {##############################################################################} | 438 {##############################################################################} |
| 489 {% block prepare_prototype_and_interface_object %}{% endblock %} | 439 {% block prepare_prototype_and_interface_object %}{% endblock %} |
| 490 {##############################################################################} | 440 {##############################################################################} |
| 491 {% block to_active_dom_object %}{% endblock %} | 441 {% block to_active_dom_object %}{% endblock %} |
| 492 {% block ref_object_and_deref_object %}{% endblock %} | 442 {% block ref_object_and_deref_object %}{% endblock %} |
| 493 {% for method in methods if method.is_implemented_in_private_script and method.v
isible %} | 443 {% for method in methods if method.is_implemented_in_private_script and method.v
isible %} |
| 494 {{method_implemented_in_private_script(method)}} | 444 {{method_implemented_in_private_script(method)}} |
| 495 {% endfor %} | 445 {% endfor %} |
| 496 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 446 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 497 {{attribute_getter_implemented_in_private_script(attribute)}} | 447 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 498 {% if attribute.has_setter %} | 448 {% if attribute.has_setter %} |
| 499 {{attribute_setter_implemented_in_private_script(attribute)}} | 449 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 500 {% endif %} | 450 {% endif %} |
| 501 {% endfor %} | 451 {% endfor %} |
| 502 {% block partial_interface %}{% endblock %} | 452 {% block partial_interface %}{% endblock %} |
| 503 } // namespace blink | 453 } // namespace blink |
| 504 {% endfilter %} | 454 {% endfilter %} |
| OLD | NEW |