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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 # String and enumeration arguments converted using one of the | 66 # String and enumeration arguments converted using one of the |
67 # TOSTRING_* macros except for _PROMISE variants in | 67 # TOSTRING_* macros except for _PROMISE variants in |
68 # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch. | 68 # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch. |
69 ((base_type == 'DOMString' or idl_type.is_enum) and | 69 ((base_type == 'DOMString' or idl_type.is_enum) and |
70 not argument.is_variadic and | 70 not argument.is_variadic and |
71 not return_promise) or | 71 not return_promise) or |
72 # Conversion that take an ExceptionState& argument throw all their | 72 # Conversion that take an ExceptionState& argument throw all their |
73 # exceptions via it, and doesn't need/use a TryCatch, except if the | 73 # exceptions via it, and doesn't need/use a TryCatch, except if the |
74 # argument has [Clamp], in which case it uses a separate code path in | 74 # argument has [Clamp], in which case it uses a separate code path in |
75 # Source/bindings/templates/methods.cpp, which *does* use a TryCatch. | 75 # Source/bindings/templates/methods.cpp, which *does* use a TryCatch. |
76 idl_type.v8_conversion_needs_exception_state) | 76 idl_type.v8_conversion_needs_exception_state or |
| 77 # A trivial conversion cannot throw exceptions at all, so doesn't need a |
| 78 # TryCatch to catch them. |
| 79 idl_type.v8_conversion_is_trivial) |
77 | 80 |
78 | 81 |
79 def use_local_result(method): | 82 def use_local_result(method): |
80 extended_attributes = method.extended_attributes | 83 extended_attributes = method.extended_attributes |
81 idl_type = method.idl_type | 84 idl_type = method.idl_type |
82 return (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or | 85 return (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or |
83 'ImplementedInPrivateScript' in extended_attributes or | 86 'ImplementedInPrivateScript' in extended_attributes or |
84 'RaisesException' in extended_attributes or | 87 'RaisesException' in extended_attributes or |
85 idl_type.is_union_type or | 88 idl_type.is_union_type or |
86 idl_type.is_explicit_nullable) | 89 idl_type.is_explicit_nullable) |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 if argument.idl_type.is_dictionary: | 461 if argument.idl_type.is_dictionary: |
459 # We always create impl objects for IDL dictionaries. | 462 # We always create impl objects for IDL dictionaries. |
460 return '%s::create()' % argument.idl_type.base_type | 463 return '%s::create()' % argument.idl_type.base_type |
461 if not argument.default_value: | 464 if not argument.default_value: |
462 return None | 465 return None |
463 return argument.idl_type.literal_cpp_value(argument.default_value) | 466 return argument.idl_type.literal_cpp_value(argument.default_value) |
464 | 467 |
465 IdlTypeBase.union_arguments = None | 468 IdlTypeBase.union_arguments = None |
466 IdlUnionType.union_arguments = property(union_arguments) | 469 IdlUnionType.union_arguments = property(union_arguments) |
467 IdlArgument.default_cpp_value = property(argument_default_cpp_value) | 470 IdlArgument.default_cpp_value = property(argument_default_cpp_value) |
OLD | NEW |