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

Side by Side Diff: lib/html/scripts/systemnative.py

Issue 11235060: Get rid of Dynamic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 is_custom = 'Custom' in operation.ext_attrs 444 is_custom = 'Custom' in operation.ext_attrs
445 has_optional_arguments = any(self._IsArgumentOptionalInWebCore(operation, ar gument) for argument in operation.arguments) 445 has_optional_arguments = any(self._IsArgumentOptionalInWebCore(operation, ar gument) for argument in operation.arguments)
446 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments) 446 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments)
447 447
448 dart_declaration = '%s%s %s(%s)' % ( 448 dart_declaration = '%s%s %s(%s)' % (
449 'static ' if info.IsStatic() else '', 449 'static ' if info.IsStatic() else '',
450 SecureOutputType(self, info.type_name), 450 SecureOutputType(self, info.type_name),
451 html_name, 451 html_name,
452 info.ParametersDeclaration( 452 info.ParametersDeclaration(
453 (lambda x: 'Dynamic') if needs_dispatcher else self._DartType)) 453 (lambda x: 'dynamic') if needs_dispatcher else self._DartType))
454 454
455 if not needs_dispatcher: 455 if not needs_dispatcher:
456 # Bind directly to native implementation 456 # Bind directly to native implementation
457 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) 457 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
458 cpp_callback_name = self._GenerateNativeBinding( 458 cpp_callback_name = self._GenerateNativeBinding(
459 info.name, argument_count, dart_declaration, 'Callback', is_custom) 459 info.name, argument_count, dart_declaration, 'Callback', is_custom)
460 if not is_custom: 460 if not is_custom:
461 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name) 461 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name)
462 else: 462 else:
463 self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos]) 463 self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos])
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 def EmitResolver(self, template, output_dir): 856 def EmitResolver(self, template, output_dir):
857 file_path = os.path.join(output_dir, 'DartResolver.cpp') 857 file_path = os.path.join(output_dir, 'DartResolver.cpp')
858 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) 858 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template)
859 for header_file in self._headers_list: 859 for header_file in self._headers_list:
860 path = os.path.relpath(header_file, output_dir) 860 path = os.path.relpath(header_file, output_dir)
861 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 861 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
862 body_emitter.Emit( 862 body_emitter.Emit(
863 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' 863 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n'
864 ' return func;\n', 864 ' return func;\n',
865 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 865 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698