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

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

Issue 1349293006: Start using the dart2js type conversions in Dartium as well. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged Created 5 years, 3 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
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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 """ 1188 """
1189 Arguments: 1189 Arguments:
1190 info: An OperationInfo object. 1190 info: An OperationInfo object.
1191 """ 1191 """
1192 return_type = self.SecureOutputType(info.type_name, False, False if dart_js_ interop else True) 1192 return_type = self.SecureOutputType(info.type_name, False, False if dart_js_ interop else True)
1193 1193
1194 formals = info.ParametersAsDeclaration(self._DartType) 1194 formals = info.ParametersAsDeclaration(self._DartType)
1195 1195
1196 parameters = info.ParametersAsListOfVariables(None, 1196 parameters = info.ParametersAsListOfVariables(None,
1197 self._type_registry if self._d art_use_blink else None, 1197 self._type_registry if self._d art_use_blink else None,
1198 dart_js_interop) 1198 dart_js_interop,
1199 self)
1199 dart_declaration = '%s%s %s(%s)' % ( 1200 dart_declaration = '%s%s %s(%s)' % (
1200 'static ' if info.IsStatic() else '', 1201 'static ' if info.IsStatic() else '',
1201 return_type, 1202 return_type,
1202 html_name, 1203 html_name,
1203 formals) 1204 formals)
1204 1205
1205 operation = info.operations[0] 1206 operation = info.operations[0]
1206 1207
1207 is_custom = _IsCustom(operation) 1208 is_custom = _IsCustom(operation)
1208 has_optional_arguments = any(IsOptional(argument) for argument in operation. arguments) 1209 has_optional_arguments = any(IsOptional(argument) for argument in operation. arguments)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 else: 1252 else:
1252 self._GenerateDispatcher(info, info.operations, dart_declaration, html_nam e) 1253 self._GenerateDispatcher(info, info.operations, dart_declaration, html_nam e)
1253 1254
1254 def _GenerateDispatcher(self, info, operations, dart_declaration, html_name): 1255 def _GenerateDispatcher(self, info, operations, dart_declaration, html_name):
1255 1256
1256 def GenerateCall( 1257 def GenerateCall(
1257 stmts_emitter, call_emitter, version, operation, argument_count): 1258 stmts_emitter, call_emitter, version, operation, argument_count):
1258 native_suffix = 'Callback' 1259 native_suffix = 'Callback'
1259 actuals = info.ParametersAsListOfVariables(argument_count, 1260 actuals = info.ParametersAsListOfVariables(argument_count,
1260 self._type_registry if self._da rt_use_blink else None, 1261 self._type_registry if self._da rt_use_blink else None,
1261 self._dart_js_interop) 1262 self._dart_js_interop,
1263 self)
1262 actuals_s = ", ".join(actuals) 1264 actuals_s = ", ".join(actuals)
1263 formals=actuals 1265 formals=actuals
1264 return_type = self.SecureOutputType(operation.type.id) 1266 return_type = self.SecureOutputType(operation.type.id)
1265 1267
1266 return_wrap_jso = False 1268 return_wrap_jso = False
1267 if self._dart_use_blink: 1269 if self._dart_use_blink:
1268 return_wrap_jso = wrap_return_type_blink(return_type, info.type_name, self._type_registry) 1270 return_wrap_jso = wrap_return_type_blink(return_type, info.type_name, self._type_registry)
1269 1271
1270 native_suffix = 'Callback' 1272 native_suffix = 'Callback'
1271 is_custom = _IsCustom(operation) 1273 is_custom = _IsCustom(operation)
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 2034
2033 def _IsCustom(op_or_attr): 2035 def _IsCustom(op_or_attr):
2034 assert(isinstance(op_or_attr, IDLMember)) 2036 assert(isinstance(op_or_attr, IDLMember))
2035 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr s 2037 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr s
2036 2038
2037 def _IsCustomValue(op_or_attr, value): 2039 def _IsCustomValue(op_or_attr, value):
2038 if _IsCustom(op_or_attr): 2040 if _IsCustom(op_or_attr):
2039 return op_or_attr.ext_attrs.get('Custom') == value \ 2041 return op_or_attr.ext_attrs.get('Custom') == value \
2040 or op_or_attr.ext_attrs.get('DartCustom') == value 2042 or op_or_attr.ext_attrs.get('DartCustom') == value
2041 return False 2043 return False
OLDNEW
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/templates/html/dartium/html_dartium.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698