| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
| 3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
| 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 5 { | 5 { |
| 6 {# Local variables #} | 6 {# Local variables #} |
| 7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
| 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 addHiddenValueToArray(info.Holder(), info[1], {{v8_class}}::eventListenerCac
heIndex, info.GetIsolate()); | 69 addHiddenValueToArray(info.Holder(), info[1], {{v8_class}}::eventListenerCac
heIndex, info.GetIsolate()); |
| 70 {% else %}{# method_name == 'removeEventListener' #} | 70 {% else %}{# method_name == 'removeEventListener' #} |
| 71 removeHiddenValueFromArray(info.Holder(), info[1], {{v8_class}}::eventListen
erCacheIndex, info.GetIsolate()); | 71 removeHiddenValueFromArray(info.Holder(), info[1], {{v8_class}}::eventListen
erCacheIndex, info.GetIsolate()); |
| 72 {% endif %} | 72 {% endif %} |
| 73 {% endmacro %} | 73 {% endmacro %} |
| 74 | 74 |
| 75 | 75 |
| 76 {######################################} | 76 {######################################} |
| 77 {% macro generate_arguments(method, world_suffix) %} | 77 {% macro generate_arguments(method, world_suffix) %} |
| 78 {% for argument in method.arguments %} | 78 {% for argument in method.arguments %} |
| 79 {{generate_argument_var_declaration(argument)}}; | 79 {{generate_argument_var_declaration(argument)}} |
| 80 {% endfor %} | 80 {%- endfor %} |
| 81 { | 81 { |
| 82 {% if method.arguments_need_try_catch %} | 82 {% if method.arguments_need_try_catch %} |
| 83 v8::TryCatch block; | 83 v8::TryCatch block; |
| 84 V8RethrowTryCatchScope rethrow(block); | 84 V8RethrowTryCatchScope rethrow(block); |
| 85 {% endif %} | 85 {% endif %} |
| 86 {% for argument in method.arguments %} | 86 {% for argument in method.arguments %} |
| 87 {% if argument.default_value %} | 87 {% if argument.default_value or argument.is_explicit_optional %} |
| 88 if (info.Length() > {{argument.index}}) { | 88 if (info.Length() > {{argument.index}}) { |
| 89 {{generate_argument(method, argument, world_suffix) | indent(8)}} | 89 {{generate_argument(method, argument, world_suffix) | indent(8)}} |
| 90 } else { | 90 } else { |
| 91 {% if argument.default_value %} |
| 91 {{argument.name}} = {{argument.default_value}}; | 92 {{argument.name}} = {{argument.default_value}}; |
| 93 {% else %} |
| 94 {{argument.name}}Missing = true; |
| 95 {% endif %} |
| 92 } | 96 } |
| 93 {% else %} | 97 {% else %} |
| 94 {{generate_argument(method, argument, world_suffix) | indent}} | 98 {{generate_argument(method, argument, world_suffix) | indent}} |
| 95 {% endif %} | 99 {% endif %} |
| 96 {% endfor %} | 100 {% endfor %} |
| 97 } | 101 } |
| 98 {% endmacro %} | 102 {% endmacro %} |
| 99 | 103 |
| 100 | 104 |
| 101 {######################################} | 105 {######################################} |
| 102 {% macro generate_argument_var_declaration(argument) %} | 106 {% macro generate_argument_var_declaration(argument) %} |
| 103 {% if argument.is_callback_interface %} | 107 {% if argument.is_callback_interface %} |
| 104 {# FIXME: remove EventListener special case #} | 108 {# FIXME: remove EventListener special case #} |
| 105 {% if argument.idl_type == 'EventListener' %} | 109 {% if argument.idl_type == 'EventListener' %} |
| 106 RefPtr<{{argument.idl_type}}> {{argument.name}} | 110 RefPtr<{{argument.idl_type}}> {{argument.name}}; |
| 107 {%- else %} | 111 {% else %} |
| 108 OwnPtr<{{argument.idl_type}}> {{argument.name}} | 112 OwnPtr<{{argument.idl_type}}> {{argument.name}}; |
| 109 {%- endif %}{# argument.idl_type == 'EventListener' #} | 113 {% endif %}{# argument.idl_type == 'EventListener' #} |
| 110 {%- elif argument.is_clamp %}{# argument.is_callback_interface #} | 114 {% elif argument.is_clamp %}{# argument.is_callback_interface #} |
| 111 {# NaN is treated as 0: http://www.w3.org/TR/WebIDL/#es-type-mapping #} | 115 {# NaN is treated as 0: http://www.w3.org/TR/WebIDL/#es-type-mapping #} |
| 112 {{argument.cpp_type}} {{argument.name}} = 0 | 116 {{argument.cpp_type}} {{argument.name}} = 0; |
| 113 {%- else %} | 117 {% else %} |
| 114 {{argument.cpp_type}} {{argument.name}} | 118 {{argument.cpp_type}} {{argument.name}}; |
| 115 {%- endif %} | 119 {% endif %} |
| 116 {% endmacro %} | 120 {% if argument.is_explicit_optional %} |
| 121 bool {{argument.name}}Missing = false; |
| 122 {% endif %} |
| 123 {%- endmacro %} |
| 117 | 124 |
| 118 | 125 |
| 119 {######################################} | 126 {######################################} |
| 120 {% macro generate_argument(method, argument, world_suffix) %} | 127 {% macro generate_argument(method, argument, world_suffix) %} |
| 121 {% if argument.is_optional and not argument.has_default and | 128 {% if argument.is_optional and not argument.is_explicit_optional and |
| 122 argument.idl_type != 'Dictionary' and | 129 not argument.has_default and argument.idl_type != 'Dictionary' and |
| 123 not argument.is_callback_interface %} | 130 not argument.is_callback_interface %} |
| 124 {# Optional arguments without a default value generate an early call with | 131 {# Optional arguments without a default value generate an early call with |
| 125 fewer arguments if they are omitted. | 132 fewer arguments if they are omitted. |
| 126 Optional Dictionary arguments default to empty dictionary. #} | 133 Optional Dictionary arguments default to empty dictionary. #} |
| 127 if (UNLIKELY(info.Length() <= {{argument.index}})) { | 134 if (UNLIKELY(info.Length() <= {{argument.index}})) { |
| 128 {% if world_suffix %} | 135 {% if world_suffix %} |
| 129 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum
ent.cpp_value) | indent}} | 136 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum
ent.cpp_value) | indent}} |
| 130 {% else %} | 137 {% else %} |
| 131 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value)
| indent}} | 138 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value)
| indent}} |
| 132 {% endif %} | 139 {% endif %} |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 {% endif %} | 571 {% endif %} |
| 565 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); | 572 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); |
| 566 {% if is_constructor_raises_exception %} | 573 {% if is_constructor_raises_exception %} |
| 567 if (exceptionState.throwIfNeeded()) | 574 if (exceptionState.throwIfNeeded()) |
| 568 return; | 575 return; |
| 569 {% endif %} | 576 {% endif %} |
| 570 | 577 |
| 571 {{generate_constructor_wrapper(constructor) | indent}} | 578 {{generate_constructor_wrapper(constructor) | indent}} |
| 572 } | 579 } |
| 573 {% endmacro %} | 580 {% endmacro %} |
| OLD | NEW |