OLD | NEW |
1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
2 | 2 |
3 | 3 |
4 {##############################################################################} | 4 {##############################################################################} |
5 {% block indexed_property_getter %} | 5 {% block indexed_property_getter %} |
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
7 {% set getter = indexed_property_getter %} | 7 {% set getter = indexed_property_getter %} |
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
9 { | 9 { |
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | 420 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
421 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value,
info); | 421 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value,
info); |
422 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 422 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
423 } | 423 } |
424 | 424 |
425 {% endif %} | 425 {% endif %} |
426 {% endblock %} | 426 {% endblock %} |
427 | 427 |
428 | 428 |
429 {##############################################################################} | 429 {##############################################################################} |
| 430 {% block named_constructor %} |
430 {% from 'methods.cpp' import generate_constructor with context %} | 431 {% from 'methods.cpp' import generate_constructor with context %} |
431 {% block named_constructor %} | |
432 {% if named_constructor %} | 432 {% if named_constructor %} |
433 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class | 433 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class |
434 if is_active_dom_object else '0' %} | 434 if is_active_dom_object else '0' %} |
435 {% set to_event_target = '%s::toEventTarget' % v8_class | 435 {% set to_event_target = '%s::toEventTarget' % v8_class |
436 if is_event_target else '0' %} | 436 if is_event_target else '0' %} |
437 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde
rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::refObject, {{v8_clas
s}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{to_event_targ
et}}, 0, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::install
ConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype,
WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTyp
eInfo::{{gc_type}} }; | 437 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde
rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::refObject, {{v8_clas
s}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{to_event_targ
et}}, 0, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::install
ConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype,
WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTyp
eInfo::{{gc_type}} }; |
438 | 438 |
439 {{generate_constructor(named_constructor)}} | 439 {{generate_constructor(named_constructor)}} |
440 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat
e* isolate) | 440 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat
e* isolate) |
441 { | 441 { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 594 } |
595 {% endif %} | 595 {% endif %} |
596 setObjectGroup(scriptWrappableBase, wrapper, isolate); | 596 setObjectGroup(scriptWrappableBase, wrapper, isolate); |
597 } | 597 } |
598 | 598 |
599 {% endif %} | 599 {% endif %} |
600 {% endblock %} | 600 {% endblock %} |
601 | 601 |
602 | 602 |
603 {##############################################################################} | 603 {##############################################################################} |
| 604 {% block shadow_attributes %} |
604 {% from 'attributes.cpp' import attribute_configuration with context %} | 605 {% from 'attributes.cpp' import attribute_configuration with context %} |
605 {% block shadow_attributes %} | |
606 {% if interface_name == 'Window' %} | 606 {% if interface_name == 'Window' %} |
607 static const V8DOMConfiguration::AttributeConfiguration shadowAttributes[] = { | 607 static const V8DOMConfiguration::AttributeConfiguration shadowAttributes[] = { |
608 {% for attribute in attributes if attribute.is_unforgeable and attribute.sho
uld_be_exposed_to_script %} | 608 {% for attribute in attributes if attribute.is_unforgeable and attribute.sho
uld_be_exposed_to_script %} |
609 {{attribute_configuration(attribute)}}, | 609 {{attribute_configuration(attribute)}}, |
610 {% endfor %} | 610 {% endfor %} |
611 }; | 611 }; |
612 | 612 |
613 {% endif %} | 613 {% endif %} |
614 {% endblock %} | 614 {% endblock %} |
615 | 615 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 }; | 723 }; |
724 V8DOMConfiguration::installAttribute({{method.function_template}}, v8::Handle<v8
::ObjectTemplate>(), {{method.name}}OriginSafeAttributeConfiguration, isolate); | 724 V8DOMConfiguration::installAttribute({{method.function_template}}, v8::Handle<v8
::ObjectTemplate>(), {{method.name}}OriginSafeAttributeConfiguration, isolate); |
725 {%- endmacro %} | 725 {%- endmacro %} |
726 | 726 |
727 | 727 |
728 {##############################################################################} | 728 {##############################################################################} |
729 {% block get_dom_template %} | 729 {% block get_dom_template %} |
730 {% if not is_array_buffer_or_view %} | 730 {% if not is_array_buffer_or_view %} |
731 v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) | 731 v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) |
732 { | 732 { |
733 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), install{{v8_class}}Template); | 733 {% if has_partial_interface %} |
| 734 {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class
, v8_class) %} |
| 735 ASSERT({{installTemplateFunction}} != {{v8_class}}::install{{v8_class}}Templ
ate); |
| 736 {% else %} |
| 737 {% set installTemplateFunction = 'install%sTemplate' % v8_class %} |
| 738 {% endif %} |
| 739 {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8
_class) if has_partial_interface else 'install%sTemplate' % v8_class %} |
| 740 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), {{installTemplateFunction}}); |
734 } | 741 } |
735 | 742 |
736 {% endif %} | 743 {% endif %} |
737 {% endblock %} | 744 {% endblock %} |
738 | 745 |
739 | 746 |
740 {##############################################################################} | 747 {##############################################################################} |
741 {% block has_instance %} | 748 {% block has_instance %} |
742 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isola
te) | 749 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isola
te) |
743 { | 750 { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(val
ue)) : 0; | 851 return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(val
ue)) : 0; |
845 {% else %} | 852 {% else %} |
846 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0; | 853 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0; |
847 {% endif %} | 854 {% endif %} |
848 } | 855 } |
849 | 856 |
850 {% endblock %} | 857 {% endblock %} |
851 | 858 |
852 | 859 |
853 {##############################################################################} | 860 {##############################################################################} |
| 861 {% block install_conditional_attributes %} |
| 862 {% from 'attributes.cpp' import attribute_configuration with context %} |
| 863 {% if has_conditional_attributes %} |
| 864 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object>
instanceObject, v8::Isolate* isolate) |
| 865 { |
| 866 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance
Object->GetPrototype()); |
| 867 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont
ext()); |
| 868 |
| 869 {% for attribute in attributes if attribute.per_context_enabled_function or
attribute.exposed_test %} |
| 870 {% filter per_context_enabled(attribute.per_context_enabled_function) %} |
| 871 {% filter exposed(attribute.exposed_test) %} |
| 872 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati
on =\ |
| 873 {{attribute_configuration(attribute)}}; |
| 874 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attrib
uteConfiguration, isolate); |
| 875 {% endfilter %} |
| 876 {% endfilter %} |
| 877 {% endfor %} |
| 878 } |
| 879 |
| 880 {% endif %} |
| 881 {% endblock %} |
| 882 |
| 883 |
| 884 {##############################################################################} |
854 {% block to_active_dom_object %} | 885 {% block to_active_dom_object %} |
855 {% if is_active_dom_object %} | 886 {% if is_active_dom_object %} |
856 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Handle<v8::Object> wrapper) | 887 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Handle<v8::Object> wrapper) |
857 { | 888 { |
858 return toImpl(wrapper); | 889 return toImpl(wrapper); |
859 } | 890 } |
860 | 891 |
861 {% endif %} | 892 {% endif %} |
862 {% endblock %} | 893 {% endblock %} |
863 | 894 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 {% endif %} | 998 {% endif %} |
968 } | 999 } |
969 | 1000 |
970 template<> | 1001 template<> |
971 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 1002 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
972 { | 1003 { |
973 return toV8(impl, creationContext, isolate); | 1004 return toV8(impl, creationContext, isolate); |
974 } | 1005 } |
975 | 1006 |
976 {% endblock %} | 1007 {% endblock %} |
| 1008 |
| 1009 {##############################################################################} |
| 1010 {% block partial_interface %} |
| 1011 {% if has_partial_interface %} |
| 1012 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins
tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template; |
| 1013 |
| 1014 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate
Function, InstallConditionallyEnabledMethodsFunction installConditionallyEnabled
MethodsFunction) |
| 1015 { |
| 1016 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction; |
| 1017 if (installConditionallyEnabledMethodsFunction) |
| 1018 {{v8_class}}::wrapperTypeInfo.installConditionallyEnabledMethodsFunction
= installConditionallyEnabledMethodsFunction; |
| 1019 } |
| 1020 |
| 1021 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 1022 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| 1023 { |
| 1024 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
| 1025 } |
| 1026 {% endfor %} |
| 1027 {% endif %} |
| 1028 {% endblock %} |
OLD | NEW |