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

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

Issue 11644103: Adding types to dart:html's dartium files where possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback. Created 7 years, 11 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 | « sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 dart_declaration = 'void operator[]=(int index, %s value)' % element_type 421 dart_declaration = 'void operator[]=(int index, %s value)' % element_type
422 self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration, 422 self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration,
423 'Callback', True) 423 'Callback', True)
424 424
425 def EmitOperation(self, info, html_name): 425 def EmitOperation(self, info, html_name):
426 """ 426 """
427 Arguments: 427 Arguments:
428 info: An OperationInfo object. 428 info: An OperationInfo object.
429 """ 429 """
430 430
431 operation = info.operations[0]
432
433 is_custom = 'Custom' in operation.ext_attrs
434 has_optional_arguments = any(self._IsArgumentOptionalInWebCore(operation, ar gument) for argument in operation.arguments)
435 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments)
436
437 dart_declaration = '%s%s %s(%s)' % ( 431 dart_declaration = '%s%s %s(%s)' % (
438 'static ' if info.IsStatic() else '', 432 'static ' if info.IsStatic() else '',
439 self.SecureOutputType(info.type_name), 433 self.SecureOutputType(info.type_name),
440 html_name, 434 html_name,
441 info.ParametersDeclaration( 435 info.ParametersDeclaration(self._DartType))
442 (lambda x: 'dynamic') if needs_dispatcher else self._DartType)) 436
437 operation = info.operations[0]
438 is_custom = 'Custom' in operation.ext_attrs
439 has_optional_arguments = any(self._IsArgumentOptionalInWebCore(operation, ar gument) for argument in operation.arguments)
440 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments)
443 441
444 if not needs_dispatcher: 442 if not needs_dispatcher:
445 # Bind directly to native implementation 443 # Bind directly to native implementation
446 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) 444 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
447 cpp_callback_name = self._GenerateNativeBinding( 445 cpp_callback_name = self._GenerateNativeBinding(
448 info.name, argument_count, dart_declaration, 'Callback', is_custom) 446 info.name, argument_count, dart_declaration, 'Callback', is_custom)
449 if not is_custom: 447 if not is_custom:
450 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name) 448 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name)
451 else: 449 else:
452 self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos]) 450 self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos])
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 LIBRARY_NAME=library_name) 874 LIBRARY_NAME=library_name)
877 875
878 headers = self._library_headers[library_name] 876 headers = self._library_headers[library_name]
879 for header_file in headers: 877 for header_file in headers:
880 path = os.path.relpath(header_file, output_dir) 878 path = os.path.relpath(header_file, output_dir)
881 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 879 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
882 body_emitter.Emit( 880 body_emitter.Emit(
883 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 881 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
884 ' return func;\n', 882 ' return func;\n',
885 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 883 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698