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 292953002: Remove mangling for custom methods in dart:_blink (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix name mangling in native_DOMImplementation Created 6 years, 7 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 def DeriveQualifiedName(library_name, name): 339 def DeriveQualifiedName(library_name, name):
340 return library_name + "." + name 340 return library_name + "." + name
341 341
342 def DeriveNativeName(interface_name, name, suffix): 342 def DeriveNativeName(interface_name, name, suffix):
343 fields = ["Native", interface_name, name] 343 fields = ["Native", interface_name, name]
344 if suffix != "": 344 if suffix != "":
345 fields.append(suffix) 345 fields.append(suffix)
346 return "_".join(fields) 346 return "_".join(fields)
347 347
348 def DeriveResolverString(interface_id, operation_id, native_suffix, type_ids): 348 def DeriveResolverString(interface_id, operation_id, native_suffix, type_ids, is _custom=False):
349 type_string = \ 349 type_string = \
350 "_".join(map(TypeIdToBlinkName, type_ids)) 350 "_".join(map(TypeIdToBlinkName, type_ids))
351 if native_suffix: 351 if native_suffix:
352 operation_id = "%s_%s" % (operation_id, native_suffix) 352 operation_id = "%s_%s" % (operation_id, native_suffix)
353 components = \ 353 if is_custom:
354 [TypeIdToBlinkName(interface_id), operation_id, 354 components = \
355 "RESOLVER_STRING", str(len(type_ids)), type_string] 355 [TypeIdToBlinkName(interface_id), operation_id]
356 else:
357 components = \
358 [TypeIdToBlinkName(interface_id), operation_id,
359 "RESOLVER_STRING", str(len(type_ids)), type_string]
356 return "_".join(components) 360 return "_".join(components)
357 361
358 # FIXME(leafp) This should really go elsewhere. I think the right thing 362 # FIXME(leafp) This should really go elsewhere. I think the right thing
359 # to do is to add support in the DartLibraries objects in systemhtml 363 # to do is to add support in the DartLibraries objects in systemhtml
360 # for emitting top level code in libraries. This can then just be a 364 # for emitting top level code in libraries. This can then just be a
361 # normal use of that kind of object 365 # normal use of that kind of object
362 def GetNativeLibraryEmitter(emitters, template_loader, 366 def GetNativeLibraryEmitter(emitters, template_loader,
363 dartium_output_dir, dart_output_dir, 367 dartium_output_dir, dart_output_dir,
364 auxiliary_dir): 368 auxiliary_dir):
365 def massage_path(path): 369 def massage_path(path):
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 1165
1162 if info.callback_args: 1166 if info.callback_args:
1163 self._AddFutureifiedOperation(info, html_name) 1167 self._AddFutureifiedOperation(info, html_name)
1164 elif not needs_dispatcher: 1168 elif not needs_dispatcher:
1165 # Bind directly to native implementation 1169 # Bind directly to native implementation
1166 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) 1170 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
1167 native_suffix = 'Callback' 1171 native_suffix = 'Callback'
1168 auto_scope_setup = self._GenerateAutoSetupScope(info.name, native_suffix) 1172 auto_scope_setup = self._GenerateAutoSetupScope(info.name, native_suffix)
1169 if self._dart_use_blink: 1173 if self._dart_use_blink:
1170 type_ids = [argument.type.id 1174 type_ids = [argument.type.id
1171 for argument in operation.arguments[:argument_count]] 1175 for argument in operation.arguments[:len(info.param_infos) ]]
1172 resolver_string = \ 1176 resolver_string = \
1173 DeriveResolverString(self._interface.id, operation.id, 1177 DeriveResolverString(self._interface.id, operation.id,
1174 native_suffix, type_ids) 1178 native_suffix, type_ids, is_custom)
1175 else: 1179 else:
1176 resolver_string = None 1180 resolver_string = None
1177 cpp_callback_name = self._GenerateNativeBinding( 1181 cpp_callback_name = self._GenerateNativeBinding(
1178 info.name, argument_count, dart_declaration, 1182 info.name, argument_count, dart_declaration,
1179 info.IsStatic(), return_type, parameters, 1183 info.IsStatic(), return_type, parameters,
1180 native_suffix, is_custom, auto_scope_setup, 1184 native_suffix, is_custom, auto_scope_setup,
1181 resolver_string=resolver_string) 1185 resolver_string=resolver_string)
1182 if not is_custom: 1186 if not is_custom:
1183 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name, auto_scope_setup) 1187 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name, auto_scope_setup)
1184 else: 1188 else:
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 e.Emit("};\n"); 1973 e.Emit("};\n");
1970 e.Emit('\n'); 1974 e.Emit('\n');
1971 e.Emit('} // namespace WebCore\n'); 1975 e.Emit('} // namespace WebCore\n');
1972 1976
1973 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1977 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1974 return ( 1978 return (
1975 interface.id.endswith('Event') and 1979 interface.id.endswith('Event') and
1976 operation.id.startswith('init') and 1980 operation.id.startswith('init') and
1977 argument.ext_attrs.get('Default') == 'Undefined' and 1981 argument.ext_attrs.get('Default') == 'Undefined' and
1978 argument.type.id == 'DOMString') 1982 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « sdk/lib/_blink/dartium/_blink_dartium.dart ('k') | tools/dom/src/blink_native_DOMImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698