| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' | 362 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' |
| 363 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w
rappable=script_wrappable, for_main_world=for_main_world, is_static=method.is_st
atic) | 363 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w
rappable=script_wrappable, for_main_world=for_main_world, is_static=method.is_st
atic) |
| 364 | 364 |
| 365 | 365 |
| 366 def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise
): | 366 def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise
): |
| 367 assert argument.is_variadic | 367 assert argument.is_variadic |
| 368 idl_type = argument.idl_type | 368 idl_type = argument.idl_type |
| 369 this_cpp_type = idl_type.cpp_type | 369 this_cpp_type = idl_type.cpp_type |
| 370 | 370 |
| 371 if method.returns_promise: | |
| 372 check_expression = 'exceptionState.hadException()' | |
| 373 else: | |
| 374 check_expression = 'exceptionState.throwIfNeeded()' | |
| 375 | |
| 376 if idl_type.is_dictionary or idl_type.is_union_type: | 371 if idl_type.is_dictionary or idl_type.is_union_type: |
| 377 vector_type = 'HeapVector' | 372 vector_type = 'HeapVector' |
| 378 else: | 373 else: |
| 379 vector_type = 'Vector' | 374 vector_type = 'Vector' |
| 380 | 375 |
| 381 return { | 376 return { |
| 382 'assign_expression': 'toImplArguments<%s<%s>>(info, %s, exceptionState)'
% (vector_type, this_cpp_type, index), | 377 'assign_expression': 'toImplArguments<%s<%s>>(info, %s, exceptionState)'
% (vector_type, this_cpp_type, index), |
| 383 'check_expression': check_expression, | 378 'check_expression': 'exceptionState.hadException()', |
| 379 'clear_exception': 'exceptionState.clearException()' if method.returns_p
romise else '', |
| 384 'cpp_type': this_cpp_type, | 380 'cpp_type': this_cpp_type, |
| 385 'cpp_name': argument.name, | 381 'cpp_name': argument.name, |
| 386 'declare_variable': False, | 382 'declare_variable': False, |
| 387 } | 383 } |
| 388 | 384 |
| 389 | 385 |
| 390 def v8_value_to_local_cpp_value(method, argument, index, return_promise=False, r
estricted_float=False): | 386 def v8_value_to_local_cpp_value(method, argument, index, return_promise=False, r
estricted_float=False): |
| 391 extended_attributes = argument.extended_attributes | 387 extended_attributes = argument.extended_attributes |
| 392 idl_type = argument.idl_type | 388 idl_type = argument.idl_type |
| 393 name = argument.name | 389 name = argument.name |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return method.idl_type and method.idl_type.name == 'Promise' | 460 return method.idl_type and method.idl_type.name == 'Promise' |
| 465 | 461 |
| 466 IdlOperation.returns_promise = property(method_returns_promise) | 462 IdlOperation.returns_promise = property(method_returns_promise) |
| 467 | 463 |
| 468 | 464 |
| 469 def argument_conversion_needs_exception_state(method, argument): | 465 def argument_conversion_needs_exception_state(method, argument): |
| 470 idl_type = argument.idl_type | 466 idl_type = argument.idl_type |
| 471 return (idl_type.v8_conversion_needs_exception_state or | 467 return (idl_type.v8_conversion_needs_exception_state or |
| 472 argument.is_variadic or | 468 argument.is_variadic or |
| 473 (method.returns_promise and idl_type.is_string_type)) | 469 (method.returns_promise and idl_type.is_string_type)) |
| OLD | NEW |