Chromium Code Reviews| Index: Source/bindings/scripts/v8_methods.py |
| diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py |
| index e748e34c7bbfadf458d5369c37211ca0d93ef026..6d2b4068e94e4092354dc0434fd1b8f02a272b48 100644 |
| --- a/Source/bindings/scripts/v8_methods.py |
| +++ b/Source/bindings/scripts/v8_methods.py |
| @@ -40,6 +40,19 @@ import v8_utilities |
| from v8_utilities import has_extended_attribute_value |
| +def argument_needs_try_catch(argument): |
| + return not ( |
| + # These cases are handled by separate code paths in the |
| + # generate_argument() macro in Source/bindings/templates/methods.cpp. |
| + argument['is_callback_interface'] or |
| + argument['idl_type'] == 'SerializedScriptValue' or |
| + argument['is_variadic_wrapper_type'] or |
| + # String and enumeration arguments converted using one of the |
| + # TOSTRING_* macros in Source/bindings/v8/V8BindingMacros.h don't |
| + # use a v8::TryCatch. |
| + argument['v8_value_to_local_cpp_value'].startswith('TOSTRING_')) |
| + |
| + |
| def generate_method(interface, method): |
| arguments = method.arguments |
| extended_attributes = method.extended_attributes |
| @@ -79,10 +92,14 @@ def generate_method(interface, method): |
| 'DoNotCheckSecurity' not in extended_attributes) |
| is_raises_exception = 'RaisesException' in extended_attributes |
| + generated_arguments = [generate_argument(interface, method, argument, index) |
| + for index, argument in enumerate(arguments)] |
| + |
| return { |
| 'activity_logging_world_list': v8_utilities.activity_logging_world_list(method), # [ActivityLogging] |
| - 'arguments': [generate_argument(interface, method, argument, index) |
| - for index, argument in enumerate(arguments)], |
| + 'arguments': generated_arguments, |
| + 'arguments_need_try_catch': any(argument_needs_try_catch(argument) |
| + for argument in generated_arguments), |
| 'conditional_string': v8_utilities.conditional_string(method), |
| 'cpp_type': idl_type.cpp_type, |
| 'cpp_value': this_cpp_value, |
| @@ -144,7 +161,9 @@ def generate_argument(interface, method, argument, index): |
| is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
| return { |
| - 'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=is_variadic_wrapper_type), |
| + 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes, |
| + used_as_argument=True, |
| + used_as_variadic_argument=argument.is_variadic), |
| 'cpp_value': this_cpp_value, |
| 'enum_validation_expression': idl_type.enum_validation_expression, |
| 'has_default': 'Default' in extended_attributes, |
| @@ -251,9 +270,8 @@ def v8_value_to_local_cpp_value(argument, index): |
| idl_type = argument.idl_type |
| name = argument.name |
| if argument.is_variadic: |
| - vector_type = v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type) |
| - return 'TONATIVE_VOID({vector_type}<{cpp_type}>, {name}, toNativeArguments<{cpp_type}>(info, {index}))'.format( |
| - vector_type=vector_type, cpp_type=idl_type.cpp_type, name=name, |
| + return 'TONATIVE_VOID_INTERNAL({name}, toNativeArguments<{cpp_type}>(info, {index}))'.format( |
| + cpp_type=idl_type.cpp_type, name=name, |
| index=index) |
|
Nils Barth (inactive)
2014/05/09 00:46:08
You can wrap this line too now.
|
| # [Default=NullString] |
| if (argument.is_optional and idl_type.name == 'String' and |
| @@ -262,7 +280,7 @@ def v8_value_to_local_cpp_value(argument, index): |
| else: |
| v8_value = 'info[%s]' % index |
| return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, |
| - name, index=index) |
| + name, index=index, declare_variable=False) |
| ################################################################################ |