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

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

Issue 25626002: Generate a library ID instead of a library name, so that the ID can be used (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/templates/html/dartium/cpp_header.template » ('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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 self._cpp_impl_emitter.Emit( 357 self._cpp_impl_emitter.Emit(
358 self._template_loader.Load('cpp_implementation.template'), 358 self._template_loader.Load('cpp_implementation.template'),
359 INTERFACE=self._interface.id, 359 INTERFACE=self._interface.id,
360 INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes), 360 INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes),
361 CALLBACKS=self._cpp_definitions_emitter.Fragments(), 361 CALLBACKS=self._cpp_definitions_emitter.Fragments(),
362 RESOLVER=self._cpp_resolver_emitter.Fragments(), 362 RESOLVER=self._cpp_resolver_emitter.Fragments(),
363 WEBCORE_CLASS_NAME=self._interface_type_info.native_type(), 363 WEBCORE_CLASS_NAME=self._interface_type_info.native_type(),
364 WEBCORE_CLASS_NAME_ESCAPED= 364 WEBCORE_CLASS_NAME_ESCAPED=
365 self._interface_type_info.native_type().replace('<', '_').replace('>', ' _'), 365 self._interface_type_info.native_type().replace('<', '_').replace('>', ' _'),
366 DART_IMPLEMENTATION_CLASS=self._interface_type_info.implementation_name( ), 366 DART_IMPLEMENTATION_CLASS=self._interface_type_info.implementation_name( ),
367 DART_IMPLEMENTATION_LIBRARY='dart:%s' % self._renamer.GetLibraryName(sel f._interface)) 367 DART_IMPLEMENTATION_LIBRARY_ID='Dart%sLibraryId' % self._renamer.GetLibr aryId(self._interface))
368 368
369 def _GenerateCPPHeader(self): 369 def _GenerateCPPHeader(self):
370 to_native_emitter = emitter.Emitter() 370 to_native_emitter = emitter.Emitter()
371 if self._interface_type_info.custom_to_native(): 371 if self._interface_type_info.custom_to_native():
372 return_type = 'PassRefPtr<NativeType>' 372 return_type = 'PassRefPtr<NativeType>'
373 to_native_body = ';' 373 to_native_body = ';'
374 to_native_arg_body = ';' 374 to_native_arg_body = ';'
375 else: 375 else:
376 return_type = 'NativeType*' 376 return_type = 'NativeType*'
377 to_native_body = emitter.Format( 377 to_native_body = emitter.Format(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if ('CustomToV8' in ext_attrs or 442 if ('CustomToV8' in ext_attrs or
443 'PureInterface' in ext_attrs or 443 'PureInterface' in ext_attrs or
444 'CPPPureInterface' in ext_attrs or 444 'CPPPureInterface' in ext_attrs or
445 self._interface_type_info.custom_to_dart()): 445 self._interface_type_info.custom_to_dart()):
446 to_dart_emitter.Emit( 446 to_dart_emitter.Emit(
447 ' static Dart_Handle createWrapper(NativeType* value);\n') 447 ' static Dart_Handle createWrapper(NativeType* value);\n')
448 else: 448 else:
449 to_dart_emitter.Emit( 449 to_dart_emitter.Emit(
450 ' static Dart_Handle createWrapper(NativeType* value)\n' 450 ' static Dart_Handle createWrapper(NativeType* value)\n'
451 ' {\n' 451 ' {\n'
452 ' return DartDOMWrapper::createWrapper<Dart$(INTERFACE)>(value) ;\n' 452 ' DartDOMData* domData = DartDOMData::current();\n'
453 ' return DartDOMWrapper::createWrapper<Dart$(INTERFACE)>(domDat a, value);\n'
453 ' }\n', 454 ' }\n',
454 INTERFACE=self._interface.id) 455 INTERFACE=self._interface.id)
455 456
456 webcore_includes = self._GenerateCPPIncludes( 457 webcore_includes = self._GenerateCPPIncludes(
457 self._interface_type_info.webcore_includes()) 458 self._interface_type_info.webcore_includes())
458 459
459 is_node_test = lambda interface: interface.id == 'Node' 460 is_node_test = lambda interface: interface.id == 'Node'
460 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs 461 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs
461 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr s 462 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr s
462 def TypeCheckHelper(test): 463 def TypeCheckHelper(test):
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1182 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1182 ' return func;\n', 1183 ' return func;\n',
1183 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1184 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1184 1185
1185 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1186 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1186 return ( 1187 return (
1187 interface.id.endswith('Event') and 1188 interface.id.endswith('Event') and
1188 operation.id.startswith('init') and 1189 operation.id.startswith('init') and
1189 argument.ext_attrs.get('Default') == 'Undefined' and 1190 argument.ext_attrs.get('Default') == 'Undefined' and
1190 argument.type.id == 'DOMString') 1191 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/templates/html/dartium/cpp_header.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698