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

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

Issue 11398002: Splitting SVG types out of dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minifying. Created 8 years, 1 month 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/html/scripts/systemhtml.py ('k') | sdk/lib/html/src/CssClassSet.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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 def FinishInterface(self): 225 def FinishInterface(self):
226 self._GenerateCPPHeader() 226 self._GenerateCPPHeader()
227 227
228 self._cpp_impl_emitter.Emit( 228 self._cpp_impl_emitter.Emit(
229 self._template_loader.Load('cpp_implementation.template'), 229 self._template_loader.Load('cpp_implementation.template'),
230 INTERFACE=self._interface.id, 230 INTERFACE=self._interface.id,
231 INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes), 231 INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes),
232 CALLBACKS=self._cpp_definitions_emitter.Fragments(), 232 CALLBACKS=self._cpp_definitions_emitter.Fragments(),
233 RESOLVER=self._cpp_resolver_emitter.Fragments(), 233 RESOLVER=self._cpp_resolver_emitter.Fragments(),
234 DART_IMPLEMENTATION_CLASS=self._interface_type_info.implementation_name( )) 234 DART_IMPLEMENTATION_CLASS=self._interface_type_info.implementation_name( ),
235 DART_IMPLEMENTATION_LIBRARY='dart:%s' % self._renamer.GetLibraryName(sel f._interface))
235 236
236 def _GenerateCPPHeader(self): 237 def _GenerateCPPHeader(self):
237 to_native_emitter = emitter.Emitter() 238 to_native_emitter = emitter.Emitter()
238 if self._interface_type_info.custom_to_native(): 239 if self._interface_type_info.custom_to_native():
239 to_native_emitter.Emit( 240 to_native_emitter.Emit(
240 ' static PassRefPtr<NativeType> toNative(Dart_Handle handle, Dart_H andle& exception);\n') 241 ' static PassRefPtr<NativeType> toNative(Dart_Handle handle, Dart_H andle& exception);\n')
241 else: 242 else:
242 to_native_emitter.Emit( 243 to_native_emitter.Emit(
243 ' static NativeType* toNative(Dart_Handle handle, Dart_Handle& exce ption)\n' 244 ' static NativeType* toNative(Dart_Handle handle, Dart_Handle& exce ption)\n'
244 ' {\n' 245 ' {\n'
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 # 379 #
379 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } 380 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; }
380 # 381 #
381 dart_element_type = self._DartType(element_type) 382 dart_element_type = self._DartType(element_type)
382 if self._HasNativeIndexGetter(): 383 if self._HasNativeIndexGetter():
383 self._EmitNativeIndexGetter(dart_element_type) 384 self._EmitNativeIndexGetter(dart_element_type)
384 else: 385 else:
385 self._members_emitter.Emit( 386 self._members_emitter.Emit(
386 '\n' 387 '\n'
387 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' , 388 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' ,
388 TYPE=self.SecureOutputType(element_type), 389 TYPE=self.SecureOutputType(element_type),
389 INTERFACE=self._interface.id) 390 INTERFACE=self._interface.id)
390 391
391 if self._HasNativeIndexSetter(): 392 if self._HasNativeIndexSetter():
392 self._EmitNativeIndexSetter(dart_element_type) 393 self._EmitNativeIndexSetter(dart_element_type)
393 else: 394 else:
394 # The HTML library implementation of NodeList has a custom indexed setter 395 # The HTML library implementation of NodeList has a custom indexed setter
395 # implementation that uses the parent node the NodeList is associated 396 # implementation that uses the parent node the NodeList is associated
396 # with if one is available. 397 # with if one is available.
397 if self._interface.id != 'NodeList': 398 if self._interface.id != 'NodeList':
398 self._members_emitter.Emit( 399 self._members_emitter.Emit(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 template = ' $CALL;\n' 509 template = ' $CALL;\n'
509 510
510 overload_name = '%s_%s' % (operation.id, version[0]) 511 overload_name = '%s_%s' % (operation.id, version[0])
511 version[0] += 1 512 version[0] += 1
512 argument_list = ', '.join(argument_names[:argument_count]) 513 argument_list = ', '.join(argument_names[:argument_count])
513 call = '_%s(%s)' % (overload_name, argument_list) 514 call = '_%s(%s)' % (overload_name, argument_list)
514 body.Emit(template, CHECKS=' && '.join(checks), CALL=call) 515 body.Emit(template, CHECKS=' && '.join(checks), CALL=call)
515 516
516 dart_declaration = '%s%s _%s(%s)' % ( 517 dart_declaration = '%s%s _%s(%s)' % (
517 'static ' if operation.is_static else '', 518 'static ' if operation.is_static else '',
518 self.SecureOutputType(operation.type.id), 519 self.SecureOutputType(operation.type.id),
519 overload_name, argument_list) 520 overload_name, argument_list)
520 cpp_callback_name = self._GenerateNativeBinding( 521 cpp_callback_name = self._GenerateNativeBinding(
521 overload_name, (0 if operation.is_static else 1) + argument_count, 522 overload_name, (0 if operation.is_static else 1) + argument_count,
522 dart_declaration, 'Callback', False) 523 dart_declaration, 'Callback', False)
523 self._GenerateOperationNativeCallback(operation, operation.arguments[:argu ment_count], cpp_callback_name) 524 self._GenerateOperationNativeCallback(operation, operation.arguments[:argu ment_count], cpp_callback_name)
524 525
525 def GenerateChecksAndCall(operation, argument_count): 526 def GenerateChecksAndCall(operation, argument_count):
526 checks = [] 527 checks = []
527 for i in range(0, argument_count): 528 for i in range(0, argument_count):
528 argument = operation.arguments[i] 529 argument = operation.arguments[i]
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 def EmitResolver(self, template, output_dir): 889 def EmitResolver(self, template, output_dir):
889 file_path = os.path.join(output_dir, 'DartResolver.cpp') 890 file_path = os.path.join(output_dir, 'DartResolver.cpp')
890 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) 891 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template)
891 for header_file in self._headers_list: 892 for header_file in self._headers_list:
892 path = os.path.relpath(header_file, output_dir) 893 path = os.path.relpath(header_file, output_dir)
893 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 894 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
894 body_emitter.Emit( 895 body_emitter.Emit(
895 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' 896 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n'
896 ' return func;\n', 897 ' return func;\n',
897 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 898 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « sdk/lib/html/scripts/systemhtml.py ('k') | sdk/lib/html/src/CssClassSet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698