OLD | NEW |
1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
2 | 2 |
| 3 {% set has_prepare_prototype_and_interface_object = |
| 4 unscopeables or has_conditional_attributes_on_prototype or |
| 5 methods | conditionally_exposed(is_partial) %} |
| 6 {% set prepare_prototype_and_interface_object_func = |
| 7 '%s::preparePrototypeAndInterfaceObject' % v8_class |
| 8 if has_prepare_prototype_and_interface_object |
| 9 else 'nullptr' %} |
| 10 |
3 | 11 |
4 {##############################################################################} | 12 {##############################################################################} |
5 {% block indexed_property_getter %} | 13 {% block indexed_property_getter %} |
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 14 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
7 {% set getter = indexed_property_getter %} | 15 {% set getter = indexed_property_getter %} |
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 16 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
9 { | 17 { |
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 18 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
11 {% if getter.is_raises_exception %} | 19 {% if getter.is_raises_exception %} |
12 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter
face_name}}", info.Holder(), info.GetIsolate()); | 20 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter
face_name}}", info.Holder(), info.GetIsolate()); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 {% set active_scriptwrappable_inheritance = | 486 {% set active_scriptwrappable_inheritance = |
479 'InheritFromActiveScriptWrappable' | 487 'InheritFromActiveScriptWrappable' |
480 if active_scriptwrappable else | 488 if active_scriptwrappable else |
481 'NotInheritFromActiveScriptWrappable' %} | 489 'NotInheritFromActiveScriptWrappable' %} |
482 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial | 490 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial |
483 // and does not depend on another global objects. | 491 // and does not depend on another global objects. |
484 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 492 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
485 #pragma clang diagnostic push | 493 #pragma clang diagnostic push |
486 #pragma clang diagnostic ignored "-Wglobal-constructors" | 494 #pragma clang diagnostic ignored "-Wglobal-constructors" |
487 #endif | 495 #endif |
488 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde
rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}:
:traceWrappers, 0, {{v8_class}}::preparePrototypeAndInterfaceObject,{% if has_co
nditional_attributes_on_instance %} {{v8_class}}::installConditionallyEnabledPro
perties{% else %} nullptr{% endif %}, "{{interface_name}}", 0, WrapperTypeInfo::
WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeIn
fo::{{active_scriptwrappable_inheritance}}, WrapperTypeInfo::{{event_target_inhe
ritance}}, WrapperTypeInfo::{{lifetime}} }; | 496 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde
rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}:
:traceWrappers, 0, {{prepare_prototype_and_interface_object_func}}, "{{interface
_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wra
pper_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, Wrappe
rTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} }; |
489 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 497 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
490 #pragma clang diagnostic pop | 498 #pragma clang diagnostic pop |
491 #endif | 499 #endif |
492 | 500 |
493 {{generate_constructor(named_constructor)}} | 501 {{generate_constructor(named_constructor)}} |
494 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate
* isolate, const DOMWrapperWorld& world) | 502 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate
* isolate, const DOMWrapperWorld& world) |
495 { | 503 { |
496 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 504 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
497 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 505 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
498 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world,
&domTemplateKey); | 506 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world,
&domTemplateKey); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 return value->Is{{interface_name}}() ? toImpl(v8::Local<v8::Object>::Cast(va
lue)) : nullptr; | 852 return value->Is{{interface_name}}() ? toImpl(v8::Local<v8::Object>::Cast(va
lue)) : nullptr; |
845 {% else %} | 853 {% else %} |
846 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; | 854 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; |
847 {% endif %} | 855 {% endif %} |
848 } | 856 } |
849 | 857 |
850 {% endblock %} | 858 {% endblock %} |
851 | 859 |
852 | 860 |
853 {##############################################################################} | 861 {##############################################################################} |
854 {% block install_conditional_attributes %} | |
855 {% from 'attributes.cpp' import attribute_configuration with context %} | |
856 {% if has_conditional_attributes_on_instance %} | |
857 void {{v8_class}}::installConditionallyEnabledProperties(v8::Local<v8::Object> i
nstanceObject, v8::Isolate* isolate) | |
858 { | |
859 #error TODO(yukishiino): Rename this function to prepareInstanceObject (c.f. pre
parePrototypeAndInterfaceObject) and implement this function if necessary. http
://crbug.com/503508 | |
860 } | |
861 | |
862 {% endif %} | |
863 {% endblock %} | |
864 | |
865 | |
866 {##############################################################################} | |
867 {% block prepare_prototype_and_interface_object %} | 862 {% block prepare_prototype_and_interface_object %} |
868 {% from 'methods.cpp' import install_conditionally_enabled_methods with context
%} | 863 {% from 'methods.cpp' import install_conditionally_enabled_methods with context
%} |
869 {% if unscopeables or has_conditional_attributes_on_prototype or methods | condi
tionally_exposed(is_partial) %} | 864 {% if has_prepare_prototype_and_interface_object %} |
870 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) | 865 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) |
871 { | 866 { |
872 v8::Isolate* isolate = context->GetIsolate(); | 867 v8::Isolate* isolate = context->GetIsolate(); |
873 {% if unscopeables %} | 868 {% if unscopeables %} |
874 {{install_unscopeables() | indent}} | 869 {{install_unscopeables() | indent}} |
875 {% endif %} | 870 {% endif %} |
876 {% if has_conditional_attributes_on_prototype %} | 871 {% if has_conditional_attributes_on_prototype %} |
877 {{install_conditionally_enabled_attributes_on_prototype() | indent}} | 872 {{install_conditionally_enabled_attributes_on_prototype() | indent}} |
878 {% endif %} | 873 {% endif %} |
879 {% if methods | conditionally_exposed(is_partial) %} | 874 {% if methods | conditionally_exposed(is_partial) %} |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 929 |
935 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 930 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
936 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 931 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
937 { | 932 { |
938 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 933 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
939 } | 934 } |
940 | 935 |
941 {% endfor %} | 936 {% endfor %} |
942 {% endif %} | 937 {% endif %} |
943 {% endblock %} | 938 {% endblock %} |
OLD | NEW |