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

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

Issue 446193002: Remove dart:blink dependency on dart:html. This CL moves all of the (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name, auto_scope_setup) 1243 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name, auto_scope_setup)
1244 else: 1244 else:
1245 self._GenerateDispatcher(info, info.operations, dart_declaration, html_nam e) 1245 self._GenerateDispatcher(info, info.operations, dart_declaration, html_nam e)
1246 1246
1247 def _GenerateDispatcher(self, info, operations, dart_declaration, html_name): 1247 def _GenerateDispatcher(self, info, operations, dart_declaration, html_name):
1248 1248
1249 def GenerateCall( 1249 def GenerateCall(
1250 stmts_emitter, call_emitter, version, operation, argument_count): 1250 stmts_emitter, call_emitter, version, operation, argument_count):
1251 native_suffix = 'Callback' 1251 native_suffix = 'Callback'
1252 actuals = info.ParametersAsListOfVariables(argument_count) 1252 actuals = info.ParametersAsListOfVariables(argument_count)
1253 actuals_s = ", ".join(actuals)
1254 formals=actuals
1253 return_type = self.SecureOutputType(operation.type.id) 1255 return_type = self.SecureOutputType(operation.type.id)
1254 native_suffix = 'Callback' 1256 native_suffix = 'Callback'
1255 is_custom = 'Custom' in operation.ext_attrs 1257 is_custom = 'Custom' in operation.ext_attrs
1256 if self._dart_use_blink: 1258 if self._dart_use_blink:
1257 base_name = '_%s_%s' % (operation.id, version) 1259 base_name = '_%s_%s' % (operation.id, version)
1260 overload_base_name = \
1261 self.DeriveNativeName(base_name, native_suffix)
1258 overload_name = \ 1262 overload_name = \
1259 self.DeriveNativeName(base_name, native_suffix) 1263 self.DeriveQualifiedBlinkName(self._interface.id,
1264 overload_base_name)
1260 static = True 1265 static = True
1261 if not operation.is_static: 1266 if not operation.is_static:
1262 actuals = ['mthis'] + actuals 1267 actuals = ['this'] + actuals
1268 formals = ['mthis'] + formals
1263 actuals_s = ", ".join(actuals) 1269 actuals_s = ", ".join(actuals)
1270 formals_s = ", ".join(formals)
1264 dart_declaration = '%s(%s)' % ( 1271 dart_declaration = '%s(%s)' % (
1265 base_name, actuals_s) 1272 base_name, formals_s)
1266 type_ids = [argument.type.id 1273 type_ids = [argument.type.id
1267 for argument in operation.arguments[:argument_count]] 1274 for argument in operation.arguments[:argument_count]]
1268 resolver_string = \ 1275 resolver_string = \
1269 DeriveResolverString(self._interface.id, operation.id, 1276 DeriveResolverString(self._interface.id, operation.id,
1270 native_suffix, type_ids, self._database, is_c ustom) 1277 native_suffix, type_ids, self._database, is_c ustom)
1271 else: 1278 else:
1272 base_name = '_%s_%s' % (operation.id, version) 1279 base_name = '_%s_%s' % (operation.id, version)
1273 overload_name = base_name 1280 overload_name = base_name
1274 static = operation.is_static 1281 static = operation.is_static
1275 actuals_s = ", ".join(actuals)
1276 dart_declaration = '%s%s %s(%s)' % ( 1282 dart_declaration = '%s%s %s(%s)' % (
1277 'static ' if static else '', 1283 'static ' if static else '',
1278 return_type, 1284 return_type,
1279 overload_name, actuals_s) 1285 overload_name, actuals_s)
1280 resolver_string = None 1286 resolver_string = None
1281 1287
1282 call_emitter.Emit('$NAME($ARGS)', NAME=overload_name, ARGS=actuals_s) 1288 call_emitter.Emit('$NAME($ARGS)', NAME=overload_name, ARGS=actuals_s)
1283 auto_scope_setup = \ 1289 auto_scope_setup = \
1284 self._GenerateAutoSetupScope(base_name, native_suffix) 1290 self._GenerateAutoSetupScope(base_name, native_suffix)
1285 cpp_callback_name = self._GenerateNativeBinding( 1291 cpp_callback_name = self._GenerateNativeBinding(
1286 base_name, (0 if static else 1) + argument_count, 1292 base_name, (0 if static else 1) + argument_count,
1287 dart_declaration, static, return_type, actuals, 1293 dart_declaration, static, return_type, formals,
1288 native_suffix, is_custom, auto_scope_setup, emit_metadata=False, 1294 native_suffix, is_custom, auto_scope_setup, emit_metadata=False,
1289 emit_to_native=self._dart_use_blink, resolver_string=resolver_string) 1295 emit_to_native=self._dart_use_blink, resolver_string=resolver_string)
1290 if not is_custom: 1296 if not is_custom:
1291 self._GenerateOperationNativeCallback(operation, 1297 self._GenerateOperationNativeCallback(operation,
1292 operation.arguments[:argument_count], cpp_callback_name, 1298 operation.arguments[:argument_count], cpp_callback_name,
1293 auto_scope_setup) 1299 auto_scope_setup)
1294 1300
1295 1301
1296 if self._dart_use_blink:
1297 name = self.DeriveNativeName(html_name)
1298 qual_name = self.DeriveQualifiedBlinkName(self._interface.id,
1299 name)
1300 actuals = info.ParametersAsListOfVariables()
1301 formals = info.ParametersAsListOfVariables()
1302 if not info.IsStatic():
1303 formals = ['mthis'] + formals
1304 actuals = ['this'] + actuals
1305 actuals_s = ', '.join(actuals)
1306 formals_s = ', '.join(formals)
1307 self._members_emitter.Emit(
1308 '\n'
1309 ' $DECLARATION => $NATIVE_NAME($ACTUALS);\n',
1310 DECLARATION=dart_declaration,
1311 NATIVE_NAME=qual_name,
1312 ACTUALS=actuals_s)
1313
1314 dart_declaration = \
1315 '// Generated overload resolver\n' \
1316 ' static %s(%s)' % (name, formals_s)
1317
1318 self._GenerateDispatcherBody( 1302 self._GenerateDispatcherBody(
1319 info, 1303 info,
1320 operations, 1304 operations,
1321 dart_declaration, 1305 dart_declaration,
1322 GenerateCall, 1306 GenerateCall,
1323 self._IsArgumentOptionalInWebCore) 1307 self._IsArgumentOptionalInWebCore)
1324 1308
1325 def SecondaryContext(self, interface): 1309 def SecondaryContext(self, interface):
1326 pass 1310 pass
1327 1311
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 e.Emit("};\n"); 2014 e.Emit("};\n");
2031 e.Emit('\n'); 2015 e.Emit('\n');
2032 e.Emit('} // namespace WebCore\n'); 2016 e.Emit('} // namespace WebCore\n');
2033 2017
2034 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 2018 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
2035 return ( 2019 return (
2036 interface.id.endswith('Event') and 2020 interface.id.endswith('Event') and
2037 operation.id.startswith('init') and 2021 operation.id.startswith('init') and
2038 argument.ext_attrs.get('Default') == 'Undefined' and 2022 argument.ext_attrs.get('Default') == 'Undefined' and
2039 argument.type.id == 'DOMString') 2023 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/templates/html/dartium/_blink_dartium.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698