| OLD | NEW |
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro attribute_configuration(attribute) %} | 5 {% macro attribute_configuration(attribute) %} |
| 6 {% set getter_callback = | 6 {% set getter_callback = |
| 7 '%sV8Internal::%sAttributeGetterCallback' % | 7 '%sV8Internal::%sAttributeGetterCallback' % |
| 8 (cpp_class, attribute.name) | 8 (cpp_class, attribute.name) |
| 9 if not attribute.constructor_type else | 9 if not attribute.constructor_type else |
| 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} | 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 v8::Local<v8::FunctionTemplate> result = data->privateTemplateIfExists(curre
ntWorldType, &privateTemplateUniqueKey); | 147 v8::Local<v8::FunctionTemplate> result = data->privateTemplateIfExists(curre
ntWorldType, &privateTemplateUniqueKey); |
| 148 if (!result.IsEmpty()) | 148 if (!result.IsEmpty()) |
| 149 return result; | 149 return result; |
| 150 | 150 |
| 151 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 151 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 152 v8::EscapableHandleScope scope(isolate); | 152 v8::EscapableHandleScope scope(isolate); |
| 153 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback)
; | 153 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback)
; |
| 154 | 154 |
| 155 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); | 155 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); |
| 156 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount); | 156 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount); |
| 157 result->SetClassName(v8::String::NewFromUtf8(isolate, "{{cpp_class}}", v8::S
tring::kInternalizedString)); | 157 result->SetClassName(v8AtomicString(isolate, "{{cpp_class}}")); |
| 158 result->Inherit({{v8_class}}::domTemplate(isolate, currentWorldType)); | 158 result->Inherit({{v8_class}}::domTemplate(isolate, currentWorldType)); |
| 159 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); | 159 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); |
| 160 | 160 |
| 161 return scope.Escape(result); | 161 return scope.Escape(result); |
| 162 } | 162 } |
| 163 | 163 |
| 164 {% endif %} | 164 {% endif %} |
| 165 {% endblock %} | 165 {% endblock %} |
| 166 | 166 |
| 167 {##############################################################################} | 167 {##############################################################################} |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 {{install_custom_signature(method)}} | 493 {{install_custom_signature(method)}} |
| 494 {% endfilter %} | 494 {% endfilter %} |
| 495 {% endif %} | 495 {% endif %} |
| 496 {% endif %}{# is_do_not_check_security #} | 496 {% endif %}{# is_do_not_check_security #} |
| 497 {% endfilter %} | 497 {% endfilter %} |
| 498 {% endif %}{# install_custom_signature #} | 498 {% endif %}{# install_custom_signature #} |
| 499 {% endfor %} | 499 {% endfor %} |
| 500 {% for attribute in attributes if attribute.is_static %} | 500 {% for attribute in attributes if attribute.is_static %} |
| 501 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 501 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
| 502 (interface_name, attribute.name) %} | 502 (interface_name, attribute.name) %} |
| 503 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "{{
attribute.name}}", v8::String::kInternalizedString), {{getter_callback}}, {{attr
ibute.setter_callback}}, v8::External::New(isolate, 0), static_cast<v8::Property
Attribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::Acces
sControl>(v8::DEFAULT)); | 503 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute
.name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New
(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces
sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 504 {% endfor %} | 504 {% endfor %} |
| 505 {% if has_custom_legacy_call_as_function %} | 505 {% if has_custom_legacy_call_as_function %} |
| 506 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}:
:legacyCallCustom); | 506 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}:
:legacyCallCustom); |
| 507 {% endif %} | 507 {% endif %} |
| 508 {% if interface_name == 'HTMLAllCollection' %} | 508 {% if interface_name == 'HTMLAllCollection' %} |
| 509 {# Needed for legacy support of document.all #} | 509 {# Needed for legacy support of document.all #} |
| 510 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 510 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
| 511 {% endif %} | 511 {% endif %} |
| 512 | 512 |
| 513 // Custom toString template | 513 // Custom toString template |
| 514 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 514 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 515 } | 515 } |
| 516 | 516 |
| 517 {% endblock %} | 517 {% endblock %} |
| 518 | 518 |
| 519 | 519 |
| 520 {######################################} | 520 {######################################} |
| 521 {% macro install_do_not_check_security_signature(method, world_suffix) %} | 521 {% macro install_do_not_check_security_signature(method, world_suffix) %} |
| 522 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithDoNotCheckSecurityS
ignature #} | 522 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithDoNotCheckSecurityS
ignature #} |
| 523 {# Methods that are [DoNotCheckSecurity] are always readable, but if they are | 523 {# Methods that are [DoNotCheckSecurity] are always readable, but if they are |
| 524 changed and then accessed from a different origin, we do not return the | 524 changed and then accessed from a different origin, we do not return the |
| 525 underlying value, but instead return a new copy of the original function. | 525 underlying value, but instead return a new copy of the original function. |
| 526 This is achieved by storing the changed value as a hidden property. #} | 526 This is achieved by storing the changed value as a hidden property. #} |
| 527 {% set getter_callback = | 527 {% set getter_callback = |
| 528 '%sV8Internal::%sOriginSafeMethodGetterCallback%s' % | 528 '%sV8Internal::%sOriginSafeMethodGetterCallback%s' % |
| 529 (cpp_class, method.name, world_suffix) %} | 529 (cpp_class, method.name, world_suffix) %} |
| 530 {% set setter_callback = | 530 {% set setter_callback = |
| 531 '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class) | 531 '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class) |
| 532 if not method.is_read_only else '0' %} | 532 if not method.is_read_only else '0' %} |
| 533 {% set property_attribute = | 533 {% set property_attribute = |
| 534 'static_cast<v8::PropertyAttribute>(%s)' % | 534 'static_cast<v8::PropertyAttribute>(%s)' % |
| 535 ' | '.join(method.property_attributes or ['v8::DontDelete']) %} | 535 ' | '.join(method.property_attributes or ['v8::DontDelete']) %} |
| 536 {{method.function_template}}->SetAccessor(v8::String::NewFromUtf8(isolate, "{{me
thod.name}}", v8::String::kInternalizedString), {{getter_callback}}, {{setter_ca
llback}}, v8Undefined(), v8::ALL_CAN_READ, {{property_attribute}}); | 536 {{method.function_template}}->SetAccessor(v8AtomicString(isolate, "{{method.name
}}"), {{getter_callback}}, {{setter_callback}}, v8Undefined(), v8::ALL_CAN_READ,
{{property_attribute}}); |
| 537 {%- endmacro %} | 537 {%- endmacro %} |
| 538 | 538 |
| 539 | 539 |
| 540 {######################################} | 540 {######################################} |
| 541 {% macro install_custom_signature(method, world_suffix) %} | 541 {% macro install_custom_signature(method, world_suffix) %} |
| 542 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithCustomSignature #} | 542 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithCustomSignature #} |
| 543 {% set method_callback = '%sV8Internal::%sMethodCallback%s' % | 543 {% set method_callback = '%sV8Internal::%sMethodCallback%s' % |
| 544 (interface_name, method.name, world_suffix) %} | 544 (interface_name, method.name, world_suffix) %} |
| 545 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 545 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
| 546 ' | '.join(method.property_attributes) %} | 546 ' | '.join(method.property_attributes) %} |
| 547 {{method.function_template}}->Set(v8::String::NewFromUtf8(isolate, "{{method.nam
e}}", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, {{met
hod_callback}}, v8Undefined(), {{method.signature}}, {{method.number_of_required
_or_variadic_arguments}}){% if method.property_attributes %}, {{property_attribu
te}}{% endif %}); | 547 {{method.function_template}}->Set(v8AtomicString(isolate, "{{method.name}}"), v8
::FunctionTemplate::New(isolate, {{method_callback}}, v8Undefined(), {{method.si
gnature}}, {{method.number_of_required_or_variadic_arguments}}){% if method.prop
erty_attributes %}, {{property_attribute}}{% endif %}); |
| 548 {%- endmacro %} | 548 {%- endmacro %} |
| 549 | 549 |
| 550 | 550 |
| 551 {######################################} | 551 {######################################} |
| 552 {% macro install_constants() %} | 552 {% macro install_constants() %} |
| 553 {# FIXME: should use reflected_name instead of name #} | 553 {# FIXME: should use reflected_name instead of name #} |
| 554 {# Normal (always enabled) constants #} | 554 {# Normal (always enabled) constants #} |
| 555 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ | 555 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ |
| 556 {% for constant in constants if not constant.runtime_enabled_function %} | 556 {% for constant in constants if not constant.runtime_enabled_function %} |
| 557 {"{{constant.name}}", {{constant.value}}}, | 557 {"{{constant.name}}", {{constant.value}}}, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 {% block install_per_context_methods %} | 635 {% block install_per_context_methods %} |
| 636 {% if has_per_context_enabled_methods %} | 636 {% if has_per_context_enabled_methods %} |
| 637 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) | 637 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) |
| 638 { | 638 { |
| 639 {# Define per-context enabled operations #} | 639 {# Define per-context enabled operations #} |
| 640 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT
emplate(isolate, worldType(isolate))); | 640 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT
emplate(isolate, worldType(isolate))); |
| 641 | 641 |
| 642 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); | 642 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); |
| 643 {% for method in methods if method.per_context_enabled_function %} | 643 {% for method in methods if method.per_context_enabled_function %} |
| 644 if (context && context->isDocument() && {{method.per_context_enabled_functio
n}}(toDocument(context))) | 644 if (context && context->isDocument() && {{method.per_context_enabled_functio
n}}(toDocument(context))) |
| 645 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "{{method.name}}
", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, {{cpp_cl
ass}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature,
{{method.number_of_required_arguments}})->GetFunction()); | 645 prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::F
unctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCall
back, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})-
>GetFunction()); |
| 646 {% endfor %} | 646 {% endfor %} |
| 647 } | 647 } |
| 648 | 648 |
| 649 {% endif %} | 649 {% endif %} |
| 650 {% endblock %} | 650 {% endblock %} |
| 651 | 651 |
| 652 | 652 |
| 653 {##############################################################################} | 653 {##############################################################################} |
| 654 {% block to_active_dom_object %} | 654 {% block to_active_dom_object %} |
| 655 {% if is_active_dom_object %} | 655 {% if is_active_dom_object %} |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 fromInternalPointer(object)->deref(); | 731 fromInternalPointer(object)->deref(); |
| 732 } | 732 } |
| 733 | 733 |
| 734 template<> | 734 template<> |
| 735 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 735 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 736 { | 736 { |
| 737 return toV8(impl, creationContext, isolate); | 737 return toV8(impl, creationContext, isolate); |
| 738 } | 738 } |
| 739 | 739 |
| 740 {% endblock %} | 740 {% endblock %} |
| OLD | NEW |