| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' | 421 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' |
| 422 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) | 422 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) |
| 423 | 423 |
| 424 | 424 |
| 425 def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise
): | 425 def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise
): |
| 426 assert argument.is_variadic | 426 assert argument.is_variadic |
| 427 idl_type = argument.idl_type | 427 idl_type = argument.idl_type |
| 428 this_cpp_type = idl_type.cpp_type | 428 this_cpp_type = idl_type.cpp_type |
| 429 | 429 |
| 430 if method.returns_promise: | |
| 431 check_expression = 'exceptionState.hadException()' | |
| 432 else: | |
| 433 check_expression = 'exceptionState.throwIfNeeded()' | |
| 434 | |
| 435 if idl_type.is_dictionary or idl_type.is_union_type: | 430 if idl_type.is_dictionary or idl_type.is_union_type: |
| 436 vector_type = 'HeapVector' | 431 vector_type = 'HeapVector' |
| 437 else: | 432 else: |
| 438 vector_type = 'Vector' | 433 vector_type = 'Vector' |
| 439 | 434 |
| 440 return { | 435 return { |
| 441 'assign_expression': 'toImplArguments<%s<%s>>(info, %s, exceptionState)'
% (vector_type, this_cpp_type, index), | 436 'assign_expression': 'toImplArguments<%s<%s>>(info, %s, exceptionState)'
% (vector_type, this_cpp_type, index), |
| 442 'check_expression': check_expression, | 437 'check_expression': 'exceptionState.hadException()', |
| 443 'cpp_type': this_cpp_type, | 438 'cpp_type': this_cpp_type, |
| 444 'cpp_name': argument.name, | 439 'cpp_name': argument.name, |
| 445 'declare_variable': False, | 440 'declare_variable': False, |
| 446 } | 441 } |
| 447 | 442 |
| 448 | 443 |
| 449 def v8_value_to_local_cpp_value(method, argument, index, return_promise=False, r
estricted_float=False): | 444 def v8_value_to_local_cpp_value(method, argument, index, return_promise=False, r
estricted_float=False): |
| 450 extended_attributes = argument.extended_attributes | 445 extended_attributes = argument.extended_attributes |
| 451 idl_type = argument.idl_type | 446 idl_type = argument.idl_type |
| 452 name = argument.name | 447 name = argument.name |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return method.idl_type and method.idl_type.name == 'Promise' | 518 return method.idl_type and method.idl_type.name == 'Promise' |
| 524 | 519 |
| 525 IdlOperation.returns_promise = property(method_returns_promise) | 520 IdlOperation.returns_promise = property(method_returns_promise) |
| 526 | 521 |
| 527 | 522 |
| 528 def argument_conversion_needs_exception_state(method, argument): | 523 def argument_conversion_needs_exception_state(method, argument): |
| 529 idl_type = argument.idl_type | 524 idl_type = argument.idl_type |
| 530 return (idl_type.v8_conversion_needs_exception_state or | 525 return (idl_type.v8_conversion_needs_exception_state or |
| 531 argument.is_variadic or | 526 argument.is_variadic or |
| 532 (method.returns_promise and idl_type.is_string_type)) | 527 (method.returns_promise and idl_type.is_string_type)) |
| OLD | NEW |