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 {% if method.number_of_required_arguments %} | 10 {% if method.number_of_required_arguments %} |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 '"The callback provided as parameter %s is not a function."' % | 127 '"The callback provided as parameter %s is not a function."' % |
128 (argument.index + 1)) | indent }} | 128 (argument.index + 1)) | indent }} |
129 return; | 129 return; |
130 } | 130 } |
131 OwnPtr<{{argument.idl_type}}> {{argument.name}} = {% if argument.is_nullable %}i
nfo[{{argument.index}}]->IsNull() ? nullptr : {% endif %}V8{{argument.idl_type}}
::create(v8::Handle<v8::Function>::Cast(info[{{argument.index}}]), currentExecut
ionContext(info.GetIsolate())); | 131 OwnPtr<{{argument.idl_type}}> {{argument.name}} = {% if argument.is_nullable %}i
nfo[{{argument.index}}]->IsNull() ? nullptr : {% endif %}V8{{argument.idl_type}}
::create(v8::Handle<v8::Function>::Cast(info[{{argument.index}}]), currentExecut
ionContext(info.GetIsolate())); |
132 {% endif %}{# argument.is_optional #} | 132 {% endif %}{# argument.is_optional #} |
133 {% endif %}{# argument.idl_type == 'EventListener' #} | 133 {% endif %}{# argument.idl_type == 'EventListener' #} |
134 {% elif argument.is_clamp %}{# argument.is_callback_interface #} | 134 {% elif argument.is_clamp %}{# argument.is_callback_interface #} |
135 {# NaN is treated as 0: http://www.w3.org/TR/WebIDL/#es-type-mapping #} | 135 {# NaN is treated as 0: http://www.w3.org/TR/WebIDL/#es-type-mapping #} |
136 {{argument.cpp_type}} {{argument.name}} = 0; | 136 {{argument.cpp_type}} {{argument.name}} = 0; |
137 V8TRYCATCH_VOID(double, {{argument.name}}NativeValue, info[{{argument.index}}]->
NumberValue()); | 137 TONATIVE_VOID(double, {{argument.name}}NativeValue, info[{{argument.index}}]->Nu
mberValue()); |
138 if (!std::isnan({{argument.name}}NativeValue)) | 138 if (!std::isnan({{argument.name}}NativeValue)) |
139 {# IDL type is used for clamping, for the right bounds, since different | 139 {# IDL type is used for clamping, for the right bounds, since different |
140 IDL integer types have same internal C++ type (int or unsigned) #} | 140 IDL integer types have same internal C++ type (int or unsigned) #} |
141 {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeVa
lue); | 141 {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeVa
lue); |
142 {% elif argument.idl_type == 'SerializedScriptValue' %} | 142 {% elif argument.idl_type == 'SerializedScriptValue' %} |
143 {{argument.cpp_type}} {{argument.name}} = SerializedScriptValue::create(info[{{a
rgument.index}}], 0, 0, exceptionState, info.GetIsolate()); | 143 {{argument.cpp_type}} {{argument.name}} = SerializedScriptValue::create(info[{{a
rgument.index}}], 0, 0, exceptionState, info.GetIsolate()); |
144 if (exceptionState.throwIfNeeded()) | 144 if (exceptionState.throwIfNeeded()) |
145 return; | 145 return; |
146 {% elif argument.is_variadic_wrapper_type %} | 146 {% elif argument.is_variadic_wrapper_type %} |
147 {{argument.vector_type}}<{{argument.cpp_type}} > {{argument.name}}; | 147 {{argument.vector_type}}<{{argument.cpp_type}} > {{argument.name}}; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 {% endfor %} | 452 {% endfor %} |
453 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); | 453 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); |
454 {% if is_constructor_raises_exception %} | 454 {% if is_constructor_raises_exception %} |
455 if (exceptionState.throwIfNeeded()) | 455 if (exceptionState.throwIfNeeded()) |
456 return; | 456 return; |
457 {% endif %} | 457 {% endif %} |
458 | 458 |
459 {{generate_constructor_wrapper(constructor) | indent}} | 459 {{generate_constructor_wrapper(constructor) | indent}} |
460 } | 460 } |
461 {% endmacro %} | 461 {% endmacro %} |
OLD | NEW |