OLD | NEW |
---|---|
1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
2 | 2 |
3 {% set has_prepare_prototype_and_interface_object = | 3 {% set has_prepare_prototype_and_interface_object = |
4 unscopeables or has_conditional_attributes_on_prototype or | 4 unscopeables 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 |
11 | 11 |
12 {##############################################################################} | 12 {##############################################################################} |
13 {% block indexed_property_getter %} | 13 {% block indexed_property_getter %} |
14 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 14 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
15 {% set getter = indexed_property_getter %} | 15 {% set getter = indexed_property_getter %} |
16 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) |
17 { | 17 { |
18 {% if getter.is_raises_exception %} | 18 {% if getter.is_raises_exception %} |
19 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGett erContext, "{{interface_name}}"); | 19 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGett erContext, "{{interface_name}}"); |
20 {% endif %} | 20 {% endif %} |
21 | 21 |
22 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 22 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
23 | 23 |
24 // We assume that all the implementations support length() method, although | |
peria
2016/09/14 15:25:03
Please use "{#...#}" style comment not to generate
Yuki
2016/09/15 09:49:17
I intentionally made this comment C++ comment so t
| |
25 // the spec doesn't require that length() must exist. It's okay that | |
26 // the interface does not have length attribute as long as the | |
27 // implementation supports length() member function. | |
28 if (index >= impl->length()) | |
29 return; // Returns undefined due to out-of-range. | |
30 | |
24 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} | 31 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} |
25 {% set getter_arguments = ['index'] %} | 32 {% set getter_arguments = ['index'] %} |
26 {% if getter.is_call_with_script_state %} | 33 {% if getter.is_call_with_script_state %} |
27 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 34 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
28 {% set getter_arguments = ['scriptState'] + getter_arguments %} | 35 {% set getter_arguments = ['scriptState'] + getter_arguments %} |
29 {% endif %} | 36 {% endif %} |
30 {% if getter.is_raises_exception %} | 37 {% if getter.is_raises_exception %} |
31 {% set getter_arguments = getter_arguments + ['exceptionState'] %} | 38 {% set getter_arguments = getter_arguments + ['exceptionState'] %} |
32 {% endif %} | 39 {% endif %} |
33 {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments | join (', ')}}); | 40 {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments | join (', ')}}); |
34 if ({{getter.is_null_expression}}) | |
35 return; | |
36 {{getter.v8_set_return_value}}; | 41 {{getter.v8_set_return_value}}; |
37 } | 42 } |
38 | 43 |
39 {% endif %} | 44 {% endif %} |
40 {% endblock %} | 45 {% endblock %} |
41 | 46 |
42 | 47 |
43 {##############################################################################} | 48 {##############################################################################} |
44 {% block indexed_property_getter_callback %} | 49 {% block indexed_property_getter_callback %} |
45 {% if indexed_property_getter or named_property_getter %} | 50 {% if indexed_property_getter or named_property_getter %} |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 | 990 |
986 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} | 991 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} |
987 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 992 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
988 { | 993 { |
989 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 994 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
990 } | 995 } |
991 | 996 |
992 {% endfor %} | 997 {% endfor %} |
993 {% endif %} | 998 {% endif %} |
994 {% endblock %} | 999 {% endblock %} |
OLD | NEW |