Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: tools/dom/scripts/systemnative.py

Issue 22859038: Use new Dart API functions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 ' return;\n', 969 ' return;\n',
970 NATIVE_TYPE=return_type_info.native_type(), 970 NATIVE_TYPE=return_type_info.native_type(),
971 FUNCTION_CALL=function_call) 971 FUNCTION_CALL=function_call)
972 value_expression = 'result' 972 value_expression = 'result'
973 else: 973 else:
974 value_expression = function_call 974 value_expression = function_call
975 975
976 # Generate to Dart conversion of C++ value. 976 # Generate to Dart conversion of C++ value.
977 if return_type_info.dart_type() == 'bool': 977 if return_type_info.dart_type() == 'bool':
978 set_return_value = 'Dart_SetBooleanReturnValue(args, %s)' % (value_expre ssion) 978 set_return_value = 'Dart_SetBooleanReturnValue(args, %s)' % (value_expre ssion)
979 elif return_type_info.dart_type() == 'int' and return_type_info.native_typ e() == 'int': 979 elif return_type_info.dart_type() == 'int':
980 set_return_value = 'Dart_SetIntegerReturnValue(args, %s)' % (value_expre ssion) 980 if return_type_info.native_type() == 'unsigned':
981 set_return_value = 'DartUtilities::setDartUnsignedReturnValue(args, %s )' % (value_expression)
982 elif return_type_info.native_type() == 'unsigned long long':
983 set_return_value = 'DartUtilities::setDartUnsignedLongLongReturnValue( args, %s)' % (value_expression)
984 else:
985 assert (return_type_info.native_type() == 'int' or return_type_info.na tive_type() == 'long long')
986 set_return_value = 'DartUtilities::setDartIntegerReturnValue(args, %s) ' % (value_expression)
981 elif return_type_info.dart_type() == 'double': 987 elif return_type_info.dart_type() == 'double':
982 set_return_value = 'Dart_SetDoubleReturnValue(args, %s)' % (value_expres sion) 988 set_return_value = 'Dart_SetDoubleReturnValue(args, %s)' % (value_expres sion)
983 elif return_type_info.dart_type() == 'String': 989 elif return_type_info.dart_type() == 'String':
984 if ext_attrs and 'TreatReturnedNullStringAs' in ext_attrs: 990 if ext_attrs and 'TreatReturnedNullStringAs' in ext_attrs:
985 set_return_value = 'DartUtilities::setDartStringReturnValueWithNullChe ck(args, %s)' % (value_expression) 991 set_return_value = 'DartUtilities::setDartStringReturnValueWithNullChe ck(args, %s)' % (value_expression)
986 else: 992 else:
987 set_return_value = 'DartUtilities::setDartStringReturnValue(args, %s)' % (value_expression) 993 set_return_value = 'DartUtilities::setDartStringReturnValue(args, %s)' % (value_expression)
988 else: 994 else:
989 to_dart_conversion = return_type_info.to_dart_conversion(value_expressio n, self._interface.id, ext_attrs) 995 to_dart_conversion = return_type_info.to_dart_conversion(value_expressio n, self._interface.id, ext_attrs)
990 set_return_value = 'Dart_SetReturnValue(args, %s)' % (to_dart_conversion ) 996 set_return_value = 'Dart_SetReturnValue(args, %s)' % (to_dart_conversion )
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1131 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1126 ' return func;\n', 1132 ' return func;\n',
1127 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1133 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1128 1134
1129 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1135 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1130 return ( 1136 return (
1131 interface.id.endswith('Event') and 1137 interface.id.endswith('Event') and
1132 operation.id.startswith('init') and 1138 operation.id.startswith('init') and
1133 argument.ext_attrs.get('Default') == 'Undefined' and 1139 argument.ext_attrs.get('Default') == 'Undefined' and
1134 argument.type.id == 'DOMString') 1140 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698