Chromium Code Reviews| Index: tools/dom/scripts/systemnative.py |
| =================================================================== |
| --- tools/dom/scripts/systemnative.py (revision 25980) |
| +++ tools/dom/scripts/systemnative.py (working copy) |
| @@ -351,6 +351,7 @@ |
| if self._interface_type_info.custom_to_native(): |
| return_type = 'PassRefPtr<NativeType>' |
| to_native_body = ';' |
| + to_native_arg_body = ';' |
| else: |
| return_type = 'NativeType*' |
| to_native_body = emitter.Format( |
| @@ -359,6 +360,12 @@ |
| ' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(handle, exception);\n' |
| ' }', |
| INTERFACE=self._interface.id) |
| + to_native_arg_body = emitter.Format( |
| + '\n' |
| + ' {\n' |
| + ' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(args, index, exception);\n' |
| + ' }', |
| + INTERFACE=self._interface.id) |
| to_native_emitter.Emit( |
| ' static $RETURN_TYPE toNative(Dart_Handle handle, Dart_Handle& exception)$TO_NATIVE_BODY\n' |
| @@ -366,9 +373,14 @@ |
| ' static $RETURN_TYPE toNativeWithNullCheck(Dart_Handle handle, Dart_Handle& exception)\n' |
| ' {\n' |
| ' return Dart_IsNull(handle) ? 0 : toNative(handle, exception);\n' |
| - ' }\n', |
| + ' }\n' |
| + '\n' |
| + ' static $RETURN_TYPE toNative(Dart_NativeArguments args, int index, Dart_Handle& exception)$TO_NATIVE_ARG_BODY\n' |
| + '\n' |
| + ' static $RETURN_TYPE toNativeWithNullCheck(Dart_NativeArguments args, int index, Dart_Handle& exception)$TO_NATIVE_ARG_BODY\n', |
|
vsm
2013/08/12 20:42:07
Why do we have both of these with the same impleme
siva
2013/08/13 17:52:52
toNativeNullCheck wants to protect against Null be
|
| RETURN_TYPE=return_type, |
| TO_NATIVE_BODY=to_native_body, |
| + TO_NATIVE_ARG_BODY=to_native_arg_body, |
| INTERFACE=self._interface.id) |
| to_dart_emitter = emitter.Emitter() |
| @@ -882,10 +894,10 @@ |
| if type_info.pass_native_by_ref(): |
| invocation_template =\ |
| ' $TYPE $ARGUMENT_NAME;\n'\ |
| - ' $CLS::$FUNCTION(Dart_GetNativeArgument(args, $INDEX), $ARGUMENT_NAME, exception);\n' |
| + ' $CLS::$FUNCTION(args, $INDEX, $ARGUMENT_NAME, exception);\n' |
| else: |
| invocation_template =\ |
| - ' $TYPE $ARGUMENT_NAME = $CLS::$FUNCTION(Dart_GetNativeArgument(args, $INDEX), exception);\n' |
| + ' $TYPE $ARGUMENT_NAME = $CLS::$FUNCTION(args, $INDEX, exception);\n' |
| body_emitter.Emit( |
| '\n' + |
| invocation_template + |
| @@ -955,6 +967,8 @@ |
| set_return_value = 'Dart_SetIntegerReturnValue(args, %s)' % (value_expression) |
| elif return_type_info.dart_type() == 'double': |
| set_return_value = 'Dart_SetDoubleReturnValue(args, %s)' % (value_expression) |
| + elif return_type_info.dart_type() == 'string': |
| + set_return_value = 'DartUtilities::setDartStringReturnValue(args, %s)' % (value_expression) |
| else: |
| to_dart_conversion = return_type_info.to_dart_conversion(value_expression, self._interface.id, ext_attrs) |
| set_return_value = 'Dart_SetReturnValue(args, %s)' % (to_dart_conversion) |