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

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

Issue 18054021: Fixing up DOM constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
216 def _EmitConstructorInfrastructure(self, 201 def _EmitConstructorInfrastructure(self,
217 constructor_info, constructor_callback_cpp_name, factory_method_name, 202 constructor_info, constructor_callback_cpp_name, factory_method_name,
218 argument_count=None): 203 argument_count=None):
219 constructor_callback_id = self._interface.id + '_' + constructor_callback_cp p_name 204 constructor_callback_id = self._interface.id + '_' + constructor_callback_cp p_name
220 if argument_count is None: 205 if argument_count is None:
221 argument_count = len(constructor_info.param_infos) 206 argument_count = len(constructor_info.param_infos)
222 207
223 self._members_emitter.Emit( 208 self._members_emitter.Emit(
224 '\n @DocsEditable\n' 209 '\n @DocsEditable\n'
225 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) ' 210 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) '
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1013 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1029 ' return func;\n', 1014 ' return func;\n',
1030 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1015 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1031 1016
1032 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1017 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1033 return ( 1018 return (
1034 interface.id.endswith('Event') and 1019 interface.id.endswith('Event') and
1035 operation.id.startswith('init') and 1020 operation.id.startswith('init') and
1036 argument.ext_attrs.get('Default') == 'Undefined' and 1021 argument.ext_attrs.get('Default') == 'Undefined' and
1037 argument.type.id == 'DOMString') 1022 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/html/dart2js/impl_Console.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698