| OLD | NEW |
| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 self._cpp_impl_includes.add('"DartArrayBufferViewCustom.h"'); | 192 self._cpp_impl_includes.add('"DartArrayBufferViewCustom.h"'); |
| 193 self._cpp_definitions_emitter.Emit( | 193 self._cpp_definitions_emitter.Emit( |
| 194 '\n' | 194 '\n' |
| 195 'static void constructorCallback(Dart_NativeArguments args)\n' | 195 'static void constructorCallback(Dart_NativeArguments args)\n' |
| 196 '{\n' | 196 '{\n' |
| 197 ' WebCore::DartArrayBufferViewInternal::constructWebGLArray<Dart$(INT
ERFACE_NAME)>(args);\n' | 197 ' WebCore::DartArrayBufferViewInternal::constructWebGLArray<Dart$(INT
ERFACE_NAME)>(args);\n' |
| 198 '}\n', | 198 '}\n', |
| 199 INTERFACE_NAME=self._interface.id); | 199 INTERFACE_NAME=self._interface.id); |
| 200 | 200 |
| 201 def EmitHelpers(self, base_class): |
| 202 # Emit internal constructor which is necessary for Dartium bindings |
| 203 # to construct wrappers from C++. Eventually it should go away |
| 204 # once it is possible to construct such an instance directly. |
| 205 if not self._members_emitter: |
| 206 return |
| 207 |
| 208 super_constructor = '' |
| 209 if base_class and base_class != 'NativeFieldWrapperClass1': |
| 210 super_constructor = ' : super.internal()' |
| 211 self._members_emitter.Emit( |
| 212 ' $CLASSNAME.internal()$SUPERCONSTRUCTOR;\n', |
| 213 CLASSNAME=self._interface_type_info.implementation_name(), |
| 214 SUPERCONSTRUCTOR=super_constructor) |
| 215 |
| 201 def _EmitConstructorInfrastructure(self, | 216 def _EmitConstructorInfrastructure(self, |
| 202 constructor_info, constructor_callback_cpp_name, factory_method_name, | 217 constructor_info, constructor_callback_cpp_name, factory_method_name, |
| 203 argument_count=None): | 218 argument_count=None): |
| 204 constructor_callback_id = self._interface.id + '_' + constructor_callback_cp
p_name | 219 constructor_callback_id = self._interface.id + '_' + constructor_callback_cp
p_name |
| 205 if argument_count is None: | 220 if argument_count is None: |
| 206 argument_count = len(constructor_info.param_infos) | 221 argument_count = len(constructor_info.param_infos) |
| 207 | 222 |
| 208 self._members_emitter.Emit( | 223 self._members_emitter.Emit( |
| 209 '\n @DocsEditable\n' | 224 '\n @DocsEditable\n' |
| 210 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) ' | 225 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) ' |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 1028 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 1014 ' return func;\n', | 1029 ' return func;\n', |
| 1015 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 1030 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 1016 | 1031 |
| 1017 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1032 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1018 return ( | 1033 return ( |
| 1019 interface.id.endswith('Event') and | 1034 interface.id.endswith('Event') and |
| 1020 operation.id.startswith('init') and | 1035 operation.id.startswith('init') and |
| 1021 argument.ext_attrs.get('Default') == 'Undefined' and | 1036 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1022 argument.type.id == 'DOMString') | 1037 argument.type.id == 'DOMString') |
| OLD | NEW |