OLD | NEW |
---|---|
1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
2 | 2 |
3 | 3 |
4 {##############################################################################} | 4 {##############################################################################} |
5 {% block security_check_functions %} | |
6 {% if has_access_check_callbacks %} | |
7 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) | |
8 { | |
9 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); | |
10 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); | |
11 } | |
12 | |
13 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>) | |
14 { | |
15 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); | |
16 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); | |
17 } | |
18 | |
19 {% endif %} | |
20 {% endblock %} | |
21 | |
22 | |
23 {##############################################################################} | |
24 {% block indexed_property_getter %} | 5 {% block indexed_property_getter %} |
25 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
26 {% set getter = indexed_property_getter %} | 7 {% set getter = indexed_property_getter %} |
27 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) |
28 { | 9 { |
29 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
30 {% if getter.is_raises_exception %} | 11 {% if getter.is_raises_exception %} |
31 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate()); | 12 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate()); |
32 {% endif %} | 13 {% endif %} |
33 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} | 14 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callba ck_for_main_world}}, {{setter_callback_for_main_world}}, &{{v8_class}}::wrapperT ypeInfo, v8::ALL_CAN_READ, {{property_attribute}}, {{only_exposed_to_private_scr ipt}}, V8DOMConfiguration::OnInstance, | 722 "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callba ck_for_main_world}}, {{setter_callback_for_main_world}}, &{{v8_class}}::wrapperT ypeInfo, v8::ALL_CAN_READ, {{property_attribute}}, {{only_exposed_to_private_scr ipt}}, V8DOMConfiguration::OnInstance, |
742 }; | 723 }; |
743 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); |
744 {%- endmacro %} | 725 {%- endmacro %} |
745 | 726 |
746 | 727 |
747 {##############################################################################} | 728 {##############################################################################} |
748 {% block get_dom_template %} | 729 {% block get_dom_template %} |
749 v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) | 730 v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) |
750 { | 731 { |
751 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), install{{v8_class}}Template); | 732 {% set installTemplateFunction = 'install%sTemplate' % v8_class if not has_parti al_interface else '%s::install%sTemplateFunction' % (v8_class, v8_class) %} |
haraken
2014/10/09 04:24:01
Instead of using 'if not ... else ...', use 'if ..
tasak
2014/10/10 07:52:23
Done.
| |
733 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), {{installTemplateFunction}}); | |
752 } | 734 } |
753 | 735 |
754 {% endblock %} | 736 {% endblock %} |
755 | 737 |
756 | 738 |
757 {##############################################################################} | 739 {##############################################################################} |
758 {% block has_instance %} | 740 {% block has_instance %} |
759 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isola te) | 741 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isola te) |
760 { | 742 { |
761 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e); | 743 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e); |
(...skipping 12 matching lines...) Expand all Loading... | |
774 {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handl e<v8::Value> value) | 756 {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handl e<v8::Value> value) |
775 { | 757 { |
776 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0; | 758 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0; |
777 } | 759 } |
778 | 760 |
779 {% endblock %} | 761 {% endblock %} |
780 | 762 |
781 | 763 |
782 {##############################################################################} | 764 {##############################################################################} |
783 {% block install_conditional_attributes %} | 765 {% block install_conditional_attributes %} |
784 {% if has_conditional_attributes %} | 766 {% if has_conditional_attributes %} |
tasak
2014/10/10 07:52:23
This code is now in interface_base.cpp.
I created
| |
785 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate) | 767 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate) |
786 { | 768 { |
787 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype()); | 769 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype()); |
788 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); | 770 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); |
789 | 771 |
790 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} | 772 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} |
791 {% filter per_context_enabled(attribute.per_context_enabled_function) %} | 773 {% filter per_context_enabled(attribute.per_context_enabled_function) %} |
792 {% filter exposed(attribute.exposed_test) %} | 774 {% filter exposed(attribute.exposed_test) %} |
793 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\ | 775 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\ |
794 {{attribute_configuration(attribute)}}; | 776 {{attribute_configuration(attribute)}}; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
960 {% endif %} | 942 {% endif %} |
961 } | 943 } |
962 | 944 |
963 template<> | 945 template<> |
964 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) | 946 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) |
965 { | 947 { |
966 return toV8(impl, creationContext, isolate); | 948 return toV8(impl, creationContext, isolate); |
967 } | 949 } |
968 | 950 |
969 {% endblock %} | 951 {% endblock %} |
952 | |
953 {##############################################################################} | |
954 {% block partial_interface %} | |
955 {% if has_partial_interface %} | |
956 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template; | |
957 | |
958 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, InstallConditionallyEnabledMethodsFunction installConditionallyEnabled MethodsFunction) | |
959 { | |
960 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction; | |
961 if (installConditionallyEnabledMethodsFunction) | |
962 {{v8_class}}::wrapperTypeInfo.installConditionallyEnabledMethodsFunction = installConditionallyEnabledMethodsFunction; | |
963 } | |
964 | |
965 {% for method in methods %} | |
966 {% if method.overloads and method.overloads.partial_overloads %} | |
967 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | |
968 { | |
969 {{cpp_class}}{{empty_or_partial}}V8Internal::{{method.name}}MethodForPartial Interface = method; | |
970 } | |
971 {% endif %} | |
972 {% endfor %} | |
973 {% endif %} | |
974 {% endblock %} | |
OLD | NEW |