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

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

Issue 10785035: Properly generate MutationCallback in dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « lib/dom/scripts/generator.py ('k') | lib/html/dartium/html_dartium.dart » ('j') | 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 25 matching lines...) Expand all
36 for operation in interface.operations: 36 for operation in interface.operations:
37 if operation.type.id == 'void': 37 if operation.type.id == 'void':
38 return_prefix = '' 38 return_prefix = ''
39 error_return = '' 39 error_return = ''
40 else: 40 else:
41 return_prefix = 'return ' 41 return_prefix = 'return '
42 error_return = ' false' 42 error_return = ' false'
43 43
44 parameters = [] 44 parameters = []
45 arguments = [] 45 arguments = []
46 conversion_includes = []
46 for argument in operation.arguments: 47 for argument in operation.arguments:
47 argument_type_info = self._type_registry.TypeInfo(argument.type.id) 48 argument_type_info = self._type_registry.TypeInfo(argument.type.id)
48 parameters.append('%s %s' % (argument_type_info.parameter_type(), 49 parameters.append('%s %s' % (argument_type_info.parameter_type(),
49 argument.id)) 50 argument.id))
50 arguments.append(argument_type_info.to_dart_conversion(argument.id)) 51 arguments.append(argument_type_info.to_dart_conversion(argument.id))
51 cpp_impl_includes |= set(argument_type_info.conversion_includes()) 52 conversion_includes.extend(argument_type_info.conversion_includes())
52 53
53 native_return_type = self._type_registry.TypeInfo(operation.type.id).nativ e_type() 54 native_return_type = self._type_registry.TypeInfo(operation.type.id).nativ e_type()
54 cpp_header_handlers_emitter.Emit( 55 cpp_header_handlers_emitter.Emit(
55 '\n' 56 '\n'
56 ' virtual $TYPE handleEvent($PARAMETERS);\n', 57 ' virtual $TYPE handleEvent($PARAMETERS);\n',
57 TYPE=native_return_type, PARAMETERS=', '.join(parameters)) 58 TYPE=native_return_type, PARAMETERS=', '.join(parameters))
58 59
60 if 'Custom' in operation.ext_attrs:
61 continue
62
63 cpp_impl_includes |= set(conversion_includes)
59 arguments_declaration = 'Dart_Handle arguments[] = { %s }' % ', '.join(arg uments) 64 arguments_declaration = 'Dart_Handle arguments[] = { %s }' % ', '.join(arg uments)
60 if not len(arguments): 65 if not len(arguments):
61 arguments_declaration = 'Dart_Handle* arguments = 0' 66 arguments_declaration = 'Dart_Handle* arguments = 0'
62 cpp_impl_handlers_emitter.Emit( 67 cpp_impl_handlers_emitter.Emit(
63 '\n' 68 '\n'
64 '$TYPE $CLASS_NAME::handleEvent($PARAMETERS)\n' 69 '$TYPE $CLASS_NAME::handleEvent($PARAMETERS)\n'
65 '{\n' 70 '{\n'
66 ' if (!m_callback.isolate()->isAlive())\n' 71 ' if (!m_callback.isolate()->isAlive())\n'
67 ' return$ERROR_RETURN;\n' 72 ' return$ERROR_RETURN;\n'
68 ' DartIsolate::Scope scope(m_callback.isolate());\n' 73 ' DartIsolate::Scope scope(m_callback.isolate());\n'
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 949
945 def _IsArgumentOptionalInWebCore(argument): 950 def _IsArgumentOptionalInWebCore(argument):
946 return IsOptional(argument) and not 'Callback' in argument.ext_attrs 951 return IsOptional(argument) and not 'Callback' in argument.ext_attrs
947 952
948 def _ToWebKitName(name): 953 def _ToWebKitName(name):
949 name = name[0].lower() + name[1:] 954 name = name[0].lower() + name[1:]
950 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), 955 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(),
951 name) 956 name)
952 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() , 957 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() ,
953 name) 958 name)
OLDNEW
« no previous file with comments | « lib/dom/scripts/generator.py ('k') | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698