| Index: tools/dom/scripts/systemnative.py
|
| ===================================================================
|
| --- tools/dom/scripts/systemnative.py (revision 27632)
|
| +++ tools/dom/scripts/systemnative.py (working copy)
|
| @@ -411,17 +411,39 @@
|
|
|
| ext_attrs = self._interface.ext_attrs
|
|
|
| + to_dart_emitter.Emit(
|
| + ' static Dart_Handle toDart(NativeType* value)\n'
|
| + ' {\n'
|
| + ' if (!value)\n'
|
| + ' return Dart_Null();\n'
|
| + ' Dart_WeakPersistentHandle result = DartDOMWrapper::lookupWrapper(isNode, value);\n'
|
| + ' if (result)\n'
|
| + ' return Dart_HandleFromWeakPersistent(result);\n'
|
| + ' return createWrapper(value);\n'
|
| + ' }\n'
|
| + ' static void returnToDart(Dart_NativeArguments args, NativeType* value)\n'
|
| + ' {\n'
|
| + ' if (value) {\n'
|
| + ' Dart_WeakPersistentHandle result = DartDOMWrapper::lookupWrapper(isNode, value);\n'
|
| + ' if (result)\n'
|
| + ' Dart_SetWeakHandleReturnValue(args, result);\n'
|
| + ' else\n'
|
| + ' Dart_SetReturnValue(args, createWrapper(value));\n'
|
| + ' }\n'
|
| + ' }\n',
|
| + )
|
| +
|
| if ('CustomToV8' in ext_attrs or
|
| 'PureInterface' in ext_attrs or
|
| 'CPPPureInterface' in ext_attrs or
|
| self._interface_type_info.custom_to_dart()):
|
| to_dart_emitter.Emit(
|
| - ' static Dart_Handle toDart(NativeType* value);\n')
|
| + ' static Dart_Handle createWrapper(NativeType* value);\n')
|
| else:
|
| to_dart_emitter.Emit(
|
| - ' static Dart_Handle toDart(NativeType* value)\n'
|
| + ' static Dart_Handle createWrapper(NativeType* value)\n'
|
| ' {\n'
|
| - ' return DartDOMWrapper::toDart<Dart$(INTERFACE)>(value);\n'
|
| + ' return DartDOMWrapper::createWrapper<Dart$(INTERFACE)>(value);\n'
|
| ' }\n',
|
| INTERFACE=self._interface.id)
|
|
|
| @@ -431,6 +453,7 @@
|
| is_node_test = lambda interface: interface.id == 'Node'
|
| is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs
|
| is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attrs
|
| +
|
| def TypeCheckHelper(test):
|
| return 'true' if any(map(test, self._database.Hierarchy(self._interface))) else 'false'
|
|
|
| @@ -1005,9 +1028,11 @@
|
| set_return_value = 'DartUtilities::setDartStringReturnValueWithNullCheck(args, %s)' % (value_expression)
|
| else:
|
| set_return_value = 'DartUtilities::setDartStringReturnValue(args, %s)' % (value_expression)
|
| + elif return_type_info.dart_type() == 'num' and return_type_info.native_type() == 'double':
|
| + set_return_value = 'Dart_SetDoubleReturnValue(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)
|
| + return_to_dart_conversion = return_type_info.return_to_dart_conversion(value_expression, self._interface.id, ext_attrs)
|
| + set_return_value = '%s' % (return_to_dart_conversion)
|
| invocation_emitter.Emit(
|
| ' $RETURN_VALUE;\n',
|
| RETURN_VALUE=set_return_value)
|
|
|