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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 {{install_custom_signature(method)}} | 502 {{install_custom_signature(method)}} |
503 {% endfilter %} | 503 {% endfilter %} |
504 {% endif %} | 504 {% endif %} |
505 {% endif %}{# is_do_not_check_security #} | 505 {% endif %}{# is_do_not_check_security #} |
506 {% endfilter %} | 506 {% endfilter %} |
507 {% endif %}{# install_custom_signature #} | 507 {% endif %}{# install_custom_signature #} |
508 {% endfor %} | 508 {% endfor %} |
509 {% for attribute in attributes if attribute.is_static %} | 509 {% for attribute in attributes if attribute.is_static %} |
510 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 510 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
511 (interface_name, attribute.name) %} | 511 (interface_name, attribute.name) %} |
512 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)); | 512 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)); |
513 {% endfor %} | 513 {% endfor %} |
514 {% if has_custom_legacy_call_as_function %} | 514 {% if has_custom_legacy_call_as_function %} |
515 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}:
:legacyCallCustom); | 515 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}:
:legacyCallCustom); |
516 {% endif %} | 516 {% endif %} |
517 {% if interface_name == 'HTMLAllCollection' %} | 517 {% if interface_name == 'HTMLAllCollection' %} |
518 {# Needed for legacy support of document.all #} | 518 {# Needed for legacy support of document.all #} |
519 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 519 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
520 {% endif %} | 520 {% endif %} |
521 | 521 |
522 // Custom toString template | 522 // Custom toString template |
523 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 523 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
524 return functionTemplate; | 524 return functionTemplate; |
525 } | 525 } |
526 | 526 |
527 {% endblock %} | 527 {% endblock %} |
528 | 528 |
529 | 529 |
530 {######################################} | 530 {######################################} |
531 {% macro install_do_not_check_security_signature(method, world_suffix) %} | 531 {% macro install_do_not_check_security_signature(method, world_suffix) %} |
532 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithDoNotCheckSecurityS
ignature #} | 532 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithDoNotCheckSecurityS
ignature #} |
533 {# Methods that are [DoNotCheckSecurity] are always readable, but if they are | 533 {# Methods that are [DoNotCheckSecurity] are always readable, but if they are |
534 changed and then accessed from a different origin, we do not return the | 534 changed and then accessed from a different origin, we do not return the |
535 underlying value, but instead return a new copy of the original function. | 535 underlying value, but instead return a new copy of the original function. |
536 This is achieved by storing the changed value as a hidden property. #} | 536 This is achieved by storing the changed value as a hidden property. #} |
537 {% set getter_callback = | 537 {% set getter_callback = |
538 '%sV8Internal::%sOriginSafeMethodGetterCallback%s' % | 538 '%sV8Internal::%sOriginSafeMethodGetterCallback%s' % |
539 (cpp_class, method.name, world_suffix) %} | 539 (cpp_class, method.name, world_suffix) %} |
540 {% set setter_callback = | 540 {% set setter_callback = |
541 '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class) | 541 '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class) |
542 if not method.is_read_only else '0' %} | 542 if not method.is_read_only else '0' %} |
543 {% set property_attribute = | 543 {% set property_attribute = |
544 'static_cast<v8::PropertyAttribute>(%s)' % | 544 'static_cast<v8::PropertyAttribute>(%s)' % |
545 ' | '.join(method.property_attributes or ['v8::DontDelete']) %} | 545 ' | '.join(method.property_attributes or ['v8::DontDelete']) %} |
546 {{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}}); | 546 {{method.function_template}}->SetAccessor(v8AtomicString(isolate, "{{method.name
}}"), {{getter_callback}}, {{setter_callback}}, v8Undefined(), v8::ALL_CAN_READ,
{{property_attribute}}); |
547 {%- endmacro %} | 547 {%- endmacro %} |
548 | 548 |
549 | 549 |
550 {######################################} | 550 {######################################} |
551 {% macro install_custom_signature(method, world_suffix) %} | 551 {% macro install_custom_signature(method, world_suffix) %} |
552 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithCustomSignature #} | 552 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithCustomSignature #} |
553 {% set method_callback = '%sV8Internal::%sMethodCallback%s' % | 553 {% set method_callback = '%sV8Internal::%sMethodCallback%s' % |
554 (interface_name, method.name, world_suffix) %} | 554 (interface_name, method.name, world_suffix) %} |
555 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 555 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
556 ' | '.join(method.property_attributes) %} | 556 ' | '.join(method.property_attributes) %} |
557 {{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 %}); | 557 {{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 %}); |
558 {%- endmacro %} | 558 {%- endmacro %} |
559 | 559 |
560 | 560 |
561 {######################################} | 561 {######################################} |
562 {% macro install_constants() %} | 562 {% macro install_constants() %} |
563 {# FIXME: should use reflected_name instead of name #} | 563 {# FIXME: should use reflected_name instead of name #} |
564 {# Normal (always enabled) constants #} | 564 {# Normal (always enabled) constants #} |
565 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ | 565 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ |
566 {% for constant in constants if not constant.runtime_enabled_function %} | 566 {% for constant in constants if not constant.runtime_enabled_function %} |
567 {"{{constant.name}}", {{constant.value}}}, | 567 {"{{constant.name}}", {{constant.value}}}, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 {% block install_per_context_methods %} | 645 {% block install_per_context_methods %} |
646 {% if has_per_context_enabled_methods %} | 646 {% if has_per_context_enabled_methods %} |
647 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) | 647 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) |
648 { | 648 { |
649 {# Define per-context enabled operations #} | 649 {# Define per-context enabled operations #} |
650 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT
emplate(isolate, worldType(isolate))); | 650 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT
emplate(isolate, worldType(isolate))); |
651 | 651 |
652 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); | 652 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); |
653 {% for method in methods if method.per_context_enabled_function %} | 653 {% for method in methods if method.per_context_enabled_function %} |
654 if (context && context->isDocument() && {{method.per_context_enabled_functio
n}}(toDocument(context))) | 654 if (context && context->isDocument() && {{method.per_context_enabled_functio
n}}(toDocument(context))) |
655 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()); | 655 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()); |
656 {% endfor %} | 656 {% endfor %} |
657 } | 657 } |
658 | 658 |
659 {% endif %} | 659 {% endif %} |
660 {% endblock %} | 660 {% endblock %} |
661 | 661 |
662 | 662 |
663 {##############################################################################} | 663 {##############################################################################} |
664 {% block to_active_dom_object %} | 664 {% block to_active_dom_object %} |
665 {% if is_active_dom_object %} | 665 {% if is_active_dom_object %} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 fromInternalPointer(object)->deref(); | 741 fromInternalPointer(object)->deref(); |
742 } | 742 } |
743 | 743 |
744 template<> | 744 template<> |
745 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 745 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
746 { | 746 { |
747 return toV8(impl, creationContext, isolate); | 747 return toV8(impl, creationContext, isolate); |
748 } | 748 } |
749 | 749 |
750 {% endblock %} | 750 {% endblock %} |
OLD | NEW |