OLD | NEW |
1 {% extends 'interface_base.cpp.tmpl' %} | 1 {% extends 'interface_base.cpp.tmpl' %} |
2 | 2 |
3 {% set has_prepare_prototype_and_interface_object = | 3 {% set has_prepare_prototype_and_interface_object = |
4 unscopables or has_conditional_attributes_on_prototype or | 4 unscopables or has_conditional_attributes_on_prototype or |
5 methods | conditionally_exposed(is_partial) %} | 5 methods | conditionally_exposed(is_partial) %} |
6 {% set prepare_prototype_and_interface_object_func = | 6 {% set prepare_prototype_and_interface_object_func = |
7 '%s::preparePrototypeAndInterfaceObject' % v8_class | 7 '%s::preparePrototypeAndInterfaceObject' % v8_class |
8 if has_prepare_prototype_and_interface_object | 8 if has_prepare_prototype_and_interface_object |
9 else 'nullptr' %} | 9 else 'nullptr' %} |
10 | 10 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 return value->Is{{interface_name}}() ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; | 855 return value->Is{{interface_name}}() ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; |
856 {% else %} | 856 {% else %} |
857 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)
) : nullptr; | 857 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)
) : nullptr; |
858 {% endif %} | 858 {% endif %} |
859 } | 859 } |
860 | 860 |
861 {% endblock %} | 861 {% endblock %} |
862 | 862 |
863 | 863 |
864 {##############################################################################} | 864 {##############################################################################} |
865 {% block prepare_prototype_and_interface_object %} | |
866 {% from 'methods.cpp.tmpl' import install_conditionally_enabled_methods with con
text %} | |
867 {% if has_prepare_prototype_and_interface_object %} | |
868 void {{v8_class}}::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> con
text, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::L
ocal<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTem
plate) { | |
869 v8::Isolate* isolate = context->GetIsolate(); | |
870 {% if unscopables %} | |
871 {{install_unscopables() | indent(2)}} | |
872 {% endif %} | |
873 {% if has_conditional_attributes_on_prototype %} | |
874 {{install_conditionally_enabled_attributes_on_prototype() | indent(2)}} | |
875 {% endif %} | |
876 {% if methods | conditionally_exposed(is_partial) %} | |
877 {{install_conditionally_enabled_methods() | indent(2)}} | |
878 {% endif %} | |
879 } | |
880 | |
881 {% endif %} | |
882 {% endblock %} | |
883 | |
884 | |
885 {##############################################################################} | |
886 {% macro install_unscopables() %} | |
887 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate)); | |
888 v8::Local<v8::Object> unscopables; | |
889 if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol))) | |
890 unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked(
).As<v8::Object>(); | |
891 else | |
892 unscopables = v8::Object::New(isolate); | |
893 {% for name, runtime_enabled_feature_name in unscopables %} | |
894 {% filter runtime_enabled(runtime_enabled_feature_name) %} | |
895 unscopables->CreateDataProperty(context, v8AtomicString(isolate, "{{name}}"), v8
::True(isolate)).FromJust(); | |
896 {% endfilter %} | |
897 {% endfor %} | |
898 prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopables).Fro
mJust(); | |
899 {% endmacro %} | |
900 | |
901 | |
902 {##############################################################################} | |
903 {% macro install_conditionally_enabled_attributes_on_prototype() %} | |
904 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} | |
905 ExecutionContext* executionContext = toExecutionContext(context); | |
906 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTempla
te); | |
907 {% for attribute in attributes if (attribute.exposed_test or attribute.secure_co
ntext_test) and attribute.on_prototype %} | |
908 {% filter exposed(attribute.exposed_test) %} | |
909 {% filter secure_context(attribute.secure_context_test) %} | |
910 {% filter runtime_enabled(attribute.runtime_enabled_feature_name) %} | |
911 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attrib
ute_configuration(attribute)}}; | |
912 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, accessorConfiguration); | |
913 {% endfilter %}{# runtime_enabled #} | |
914 {% endfilter %}{# secure_context #} | |
915 {% endfilter %}{# exposed #} | |
916 {% endfor %} | |
917 {% endmacro %} | |
918 | |
919 | |
920 {##############################################################################} | |
921 {% block partial_interface %} | 865 {% block partial_interface %} |
922 {% if has_partial_interface %} | 866 {% if has_partial_interface %} |
923 {% if needs_runtime_enabled_installer %} | 867 {% if needs_runtime_enabled_installer %} |
924 InstallRuntimeEnabledFunction {{v8_class}}::install{{v8_class}}RuntimeEnabledFun
ction = | 868 InstallRuntimeEnabledFunction {{v8_class}}::install{{v8_class}}RuntimeEnabledFun
ction = |
925 &{{v8_class}}::installRuntimeEnabledFeatures; | 869 &{{v8_class}}::installRuntimeEnabledFeatures; |
926 {% endif %} | 870 {% endif %} |
927 | 871 |
928 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = | 872 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = |
929 &{{v8_class}}::install{{v8_class}}Template; | 873 &{{v8_class}}::install{{v8_class}}Template; |
930 | 874 |
(...skipping 17 matching lines...) Expand all Loading... |
948 } | 892 } |
949 | 893 |
950 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 894 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
951 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { | 895 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { |
952 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 896 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
953 } | 897 } |
954 | 898 |
955 {% endfor %} | 899 {% endfor %} |
956 {% endif %} | 900 {% endif %} |
957 {% endblock %} | 901 {% endblock %} |
OLD | NEW |