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