| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 {% endif %} | 245 {% endif %} |
| 246 {# Call #} | 246 {# Call #} |
| 247 {% if method.idl_type == 'void' %} | 247 {% if method.idl_type == 'void' %} |
| 248 {{cpp_value}}; | 248 {{cpp_value}}; |
| 249 {% elif method.is_implemented_in_private_script %} | 249 {% elif method.is_implemented_in_private_script %} |
| 250 {{method.cpp_type}} result; | 250 {{method.cpp_type}} result; |
| 251 if (!{{method.cpp_value}}) | 251 if (!{{method.cpp_value}}) |
| 252 return; | 252 return; |
| 253 {% elif method.is_constructor %} | 253 {% elif method.is_constructor %} |
| 254 {{method.cpp_type}} impl = {{cpp_value}}; | 254 {{method.cpp_type}} impl = {{cpp_value}}; |
| 255 {% elif method.is_call_with_script_state or method.is_raises_exception %} | 255 {% elif method.use_local_result and not method.union_arguments %} |
| 256 {# FIXME: consider always using a local variable #} | |
| 257 {{method.cpp_type}} result = {{cpp_value}}; | 256 {{method.cpp_type}} result = {{cpp_value}}; |
| 258 {% endif %} | 257 {% endif %} |
| 259 {# Post-call #} | 258 {# Post-call #} |
| 260 {% if method.is_raises_exception %} | 259 {% if method.is_raises_exception %} |
| 261 if (exceptionState.hadException()) { | 260 if (exceptionState.hadException()) { |
| 262 {{throw_from_exception_state(method)}}; | 261 {{throw_from_exception_state(method)}}; |
| 263 return; | 262 return; |
| 264 } | 263 } |
| 265 {% endif %} | 264 {% endif %} |
| 266 {# Set return value #} | 265 {# Set return value #} |
| 267 {% if method.is_constructor %} | 266 {% if method.is_constructor %} |
| 268 {{generate_constructor_wrapper(method)}} | 267 {{generate_constructor_wrapper(method)}} |
| 269 {%- elif method.union_arguments %} | 268 {%- elif method.union_arguments %} |
| 270 {{union_type_method_call_and_set_return_value(method)}} | 269 {{union_type_method_call_and_set_return_value(method)}} |
| 271 {%- elif v8_set_return_value %} | 270 {%- elif v8_set_return_value %} |
| 271 {% if method.is_nullable %} |
| 272 if (result.isNull()) |
| 273 v8SetReturnValueNull(info); |
| 274 else |
| 275 {{v8_set_return_value}}; |
| 276 {% else %} |
| 272 {{v8_set_return_value}}; | 277 {{v8_set_return_value}}; |
| 278 {% endif %} |
| 273 {%- endif %}{# None for void #} | 279 {%- endif %}{# None for void #} |
| 274 {# Post-set #} | 280 {# Post-set #} |
| 275 {% if interface_name == 'EventTarget' and method.name in ('addEventListener', | 281 {% if interface_name == 'EventTarget' and method.name in ('addEventListener', |
| 276 'removeEventListener')
%} | 282 'removeEventListener')
%} |
| 277 {% set hidden_dependency_action = 'addHiddenValueToArray' | 283 {% set hidden_dependency_action = 'addHiddenValueToArray' |
| 278 if method.name == 'addEventListener' else 'removeHiddenValueFromArray' %} | 284 if method.name == 'addEventListener' else 'removeHiddenValueFromArray' %} |
| 279 {# Length check needed to skip action on legacy calls without enough arguments. | 285 {# Length check needed to skip action on legacy calls without enough arguments. |
| 280 http://crbug.com/353484 #} | 286 http://crbug.com/353484 #} |
| 281 if (info.Length() >= 2 && listener && !impl->toNode()) | 287 if (info.Length() >= 2 && listener && !impl->toNode()) |
| 282 {{hidden_dependency_action}}(info.Holder(), info[1], {{v8_class}}::eventList
enerCacheIndex, info.GetIsolate()); | 288 {{hidden_dependency_action}}(info.Holder(), info[1], {{v8_class}}::eventList
enerCacheIndex, info.GetIsolate()); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); | 591 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); |
| 586 {% else %} | 592 {% else %} |
| 587 {% set constructor_class = v8_class + ('Constructor' | 593 {% set constructor_class = v8_class + ('Constructor' |
| 588 if constructor.is_named_constructor else | 594 if constructor.is_named_constructor else |
| 589 '') %} | 595 '') %} |
| 590 v8::Handle<v8::Object> wrapper = info.Holder(); | 596 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 591 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); | 597 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); |
| 592 {% endif %} | 598 {% endif %} |
| 593 v8SetReturnValue(info, wrapper); | 599 v8SetReturnValue(info, wrapper); |
| 594 {% endmacro %} | 600 {% endmacro %} |
| OLD | NEW |