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

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

Issue 10698108: Stop passing HtmlSystemShared around and move html renaming to IDLTypeInfo. (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
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
11 import systembase 11 import systembase
12 from generator import * 12 from generator import *
13 from systemhtml import HtmlSystemShared
14 13
15 14
16 class NativeImplementationSystem(systembase.System): 15 class NativeImplementationSystem(systembase.System):
17 16
18 def __init__(self, templates, database, emitters, output_dir, auxiliary_dir): 17 def __init__(self, templates, database, emitters, output_dir, auxiliary_dir):
19 super(NativeImplementationSystem, self).__init__( 18 super(NativeImplementationSystem, self).__init__(
20 templates, database, emitters, output_dir) 19 templates, database, emitters, output_dir)
21 self._auxiliary_dir = auxiliary_dir 20 self._auxiliary_dir = auxiliary_dir
22 self._cpp_header_files = [] 21 self._cpp_header_files = []
23 self._cpp_impl_files = [] 22 self._cpp_impl_files = []
24 self._html_system = HtmlSystemShared(database)
25 23
26 def ImplementationGenerator(self, interface): 24 def ImplementationGenerator(self, interface):
27 return NativeImplementationGenerator(self, interface) 25 return NativeImplementationGenerator(self, interface)
28 26
29 def ProcessCallback(self, interface, info): 27 def ProcessCallback(self, interface, info):
30 self._interface = interface 28 self._interface = interface
31 29
32 if IsPureInterface(self._interface.id): 30 if IsPureInterface(self._interface.id):
33 return None 31 return None
34 32
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Args: 159 Args:
162 system: The NativeImplementationSystem. 160 system: The NativeImplementationSystem.
163 interface: an IDLInterface instance. It is assumed that all types have 161 interface: an IDLInterface instance. It is assumed that all types have
164 been converted to Dart types (e.g. int, String), unless they are in 162 been converted to Dart types (e.g. int, String), unless they are in
165 the same package as the interface. 163 the same package as the interface.
166 """ 164 """
167 super(NativeImplementationGenerator, self).__init__( 165 super(NativeImplementationGenerator, self).__init__(
168 system._database, interface) 166 system._database, interface)
169 self._system = system 167 self._system = system
170 self._current_secondary_parent = None 168 self._current_secondary_parent = None
171 self._html_system = self._system._html_system 169 self._html_interface_name = DartInterfaceName(self._interface)
172 self._html_interface_name = self._html_system._html_renames.get(
173 self._interface.id, self._interface.id)
174 170
175 def HasImplementation(self): 171 def HasImplementation(self):
176 return not IsPureInterface(self._interface.id) 172 return not IsPureInterface(self._interface.id)
177 173
178 def ImplementationClassName(self): 174 def ImplementationClassName(self):
179 return self._ImplClassName(self._interface.id) 175 return self._ImplClassName(self._interface.id)
180 176
181 def FilePathForDartImplementation(self): 177 def FilePathForDartImplementation(self):
182 return os.path.join(self._system._output_dir, 'dart', 178 return os.path.join(self._system._output_dir, 'dart',
183 '%sImplementation.dart' % self._interface.id) 179 '%sImplementation.dart' % self._interface.id)
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 310
315 self._GenerateNativeCallback(callback_name='constructorCallback', 311 self._GenerateNativeCallback(callback_name='constructorCallback',
316 parameter_definitions=parameter_definitions_emitter.Fragments(), 312 parameter_definitions=parameter_definitions_emitter.Fragments(),
317 needs_receiver=False, invocation=invocation, 313 needs_receiver=False, invocation=invocation,
318 raises_exceptions=raises_exceptions, 314 raises_exceptions=raises_exceptions,
319 runtime_check=runtime_check) 315 runtime_check=runtime_check)
320 316
321 def _ImplClassName(self, interface_name): 317 def _ImplClassName(self, interface_name):
322 return '_%sImpl' % interface_name 318 return '_%sImpl' % interface_name
323 319
324 def _DartType(self, idl_type):
325 return self._html_system.DartType(idl_type)
326
327 def _BaseClassName(self): 320 def _BaseClassName(self):
328 root_class = 'NativeFieldWrapperClass1' 321 root_class = 'NativeFieldWrapperClass1'
329 322
330 if not self._interface.parents: 323 if not self._interface.parents:
331 return root_class 324 return root_class
332 325
333 supertype = self._interface.parents[0].type.id 326 supertype = self._interface.parents[0].type.id
334 327
335 if IsPureInterface(supertype): # The class is a root. 328 if IsPureInterface(supertype): # The class is a root.
336 return root_class 329 return root_class
(...skipping 16 matching lines...) Expand all
353 template_file = 'factoryprovider_%s.darttemplate' % self._html_interface_nam e 346 template_file = 'factoryprovider_%s.darttemplate' % self._html_interface_nam e
354 template = self._system._templates.TryLoad(template_file) 347 template = self._system._templates.TryLoad(template_file)
355 if not template: 348 if not template:
356 template = self._system._templates.Load('factoryprovider.darttemplate') 349 template = self._system._templates.Load('factoryprovider.darttemplate')
357 350
358 native_binding = '%s_constructor_Callback' % self._interface.id 351 native_binding = '%s_constructor_Callback' % self._interface.id
359 emitter.Emit( 352 emitter.Emit(
360 template, 353 template,
361 FACTORYPROVIDER=factory_provider, 354 FACTORYPROVIDER=factory_provider,
362 INTERFACE=self._html_interface_name, 355 INTERFACE=self._html_interface_name,
363 PARAMETERS=constructor_info.ParametersImplementationDeclaration(self._Da rtType), 356 PARAMETERS=constructor_info.ParametersImplementationDeclaration(),
364 ARGUMENTS=constructor_info.ParametersAsArgumentList(), 357 ARGUMENTS=constructor_info.ParametersAsArgumentList(),
365 NATIVE_NAME=native_binding) 358 NATIVE_NAME=native_binding)
366 359
367 def FinishInterface(self): 360 def FinishInterface(self):
368 template = None 361 template = None
369 if self._html_interface_name == self._interface.id or not self._database.Has Interface(self._html_interface_name): 362 if self._html_interface_name == self._interface.id or not self._database.Has Interface(self._html_interface_name):
370 template_file = 'impl_%s.darttemplate' % self._html_interface_name 363 template_file = 'impl_%s.darttemplate' % self._html_interface_name
371 template = self._system._templates.TryLoad(template_file) 364 template = self._system._templates.TryLoad(template_file)
372 if not template: 365 if not template:
373 template = self._system._templates.Load('dart_implementation.darttemplate' ) 366 template = self._system._templates.Load('dart_implementation.darttemplate' )
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 if 'CheckSecurityForNode' in attribute.ext_attrs: 466 if 'CheckSecurityForNode' in attribute.ext_attrs:
474 # FIXME: exclude from interface as well. 467 # FIXME: exclude from interface as well.
475 return 468 return
476 469
477 self._AddGetter(attribute, html_name) 470 self._AddGetter(attribute, html_name)
478 if not read_only: 471 if not read_only:
479 self._AddSetter(attribute, html_name) 472 self._AddSetter(attribute, html_name)
480 473
481 def _AddGetter(self, attr, html_name): 474 def _AddGetter(self, attr, html_name):
482 type_info = GetIDLTypeInfo(attr.type.id) 475 type_info = GetIDLTypeInfo(attr.type.id)
483 dart_declaration = '%s get %s()' % (self._DartType(attr.type.id), html_name) 476 dart_declaration = '%s get %s()' % (DartType(attr.type.id), html_name)
484 is_custom = 'Custom' in attr.ext_attrs or 'CustomGetter' in attr.ext_attrs 477 is_custom = 'Custom' in attr.ext_attrs or 'CustomGetter' in attr.ext_attrs
485 cpp_callback_name = self._GenerateNativeBinding(attr.id, 1, 478 cpp_callback_name = self._GenerateNativeBinding(attr.id, 1,
486 dart_declaration, 'Getter', is_custom) 479 dart_declaration, 'Getter', is_custom)
487 if is_custom: 480 if is_custom:
488 return 481 return
489 482
490 arguments = [] 483 arguments = []
491 parameter_definitions_emitter = emitter.Emitter() 484 parameter_definitions_emitter = emitter.Emitter()
492 raises_exceptions = self._GenerateCallWithHandling(attr, parameter_definitio ns_emitter, arguments) 485 raises_exceptions = self._GenerateCallWithHandling(attr, parameter_definitio ns_emitter, arguments)
493 raises_exceptions = raises_exceptions or attr.get_raises 486 raises_exceptions = raises_exceptions or attr.get_raises
(...skipping 17 matching lines...) Expand all
511 webcore_function_name += 'Animated' 504 webcore_function_name += 'Animated'
512 505
513 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr) 506 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr)
514 invocation = self._GenerateWebCoreInvocation(function_expression, 507 invocation = self._GenerateWebCoreInvocation(function_expression,
515 arguments, attr.type.id, attr.ext_attrs, attr.get_raises) 508 arguments, attr.type.id, attr.ext_attrs, attr.get_raises)
516 self._GenerateNativeCallback(cpp_callback_name, parameter_definitions_emitte r.Fragments(), 509 self._GenerateNativeCallback(cpp_callback_name, parameter_definitions_emitte r.Fragments(),
517 True, invocation, raises_exceptions=raises_exceptions) 510 True, invocation, raises_exceptions=raises_exceptions)
518 511
519 def _AddSetter(self, attr, html_name): 512 def _AddSetter(self, attr, html_name):
520 type_info = GetIDLTypeInfo(attr.type.id) 513 type_info = GetIDLTypeInfo(attr.type.id)
521 dart_declaration = 'void set %s(%s)' % (html_name, self._DartType(attr.type. id)) 514 dart_declaration = 'void set %s(%s)' % (html_name, DartType(attr.type.id))
522 is_custom = set(['Custom', 'CustomSetter', 'V8CustomSetter']) & set(attr.ext _attrs) 515 is_custom = set(['Custom', 'CustomSetter', 'V8CustomSetter']) & set(attr.ext _attrs)
523 cpp_callback_name = self._GenerateNativeBinding(attr.id, 2, 516 cpp_callback_name = self._GenerateNativeBinding(attr.id, 2,
524 dart_declaration, 'Setter', is_custom) 517 dart_declaration, 'Setter', is_custom)
525 if is_custom: 518 if is_custom:
526 return 519 return
527 520
528 arguments = [] 521 arguments = []
529 parameter_definitions_emitter = emitter.Emitter() 522 parameter_definitions_emitter = emitter.Emitter()
530 self._GenerateCallWithHandling(attr, parameter_definitions_emitter, argument s) 523 self._GenerateCallWithHandling(attr, parameter_definitions_emitter, argument s)
531 524
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 # interface Y extends X, List<T> ... 557 # interface Y extends X, List<T> ...
565 # 558 #
566 # In the non-root case we have to choose between: 559 # In the non-root case we have to choose between:
567 # 560 #
568 # class YImpl extends XImpl { add List<T> methods; } 561 # class YImpl extends XImpl { add List<T> methods; }
569 # 562 #
570 # and 563 # and
571 # 564 #
572 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } 565 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; }
573 # 566 #
574 dart_element_type = self._DartType(element_type) 567 dart_element_type = DartType(element_type)
575 if self._HasNativeIndexGetter(): 568 if self._HasNativeIndexGetter():
576 self._EmitNativeIndexGetter(dart_element_type) 569 self._EmitNativeIndexGetter(dart_element_type)
577 else: 570 else:
578 self._members_emitter.Emit( 571 self._members_emitter.Emit(
579 '\n' 572 '\n'
580 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' , 573 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' ,
581 TYPE=dart_element_type, INTERFACE=self._interface.id) 574 TYPE=dart_element_type, INTERFACE=self._interface.id)
582 575
583 if self._HasNativeIndexSetter(): 576 if self._HasNativeIndexSetter():
584 self._EmitNativeIndexSetter(dart_element_type) 577 self._EmitNativeIndexSetter(dart_element_type)
(...skipping 20 matching lines...) Expand all
605 self._members_emitter.Emit(template, E=dart_element_type) 598 self._members_emitter.Emit(template, E=dart_element_type)
606 599
607 def AmendIndexer(self, element_type): 600 def AmendIndexer(self, element_type):
608 # If interface is marked as having native indexed 601 # If interface is marked as having native indexed
609 # getter or setter, we must emit overrides as it's not 602 # getter or setter, we must emit overrides as it's not
610 # guaranteed that the corresponding methods in C++ would be 603 # guaranteed that the corresponding methods in C++ would be
611 # virtual. For example, as of time of writing, even though 604 # virtual. For example, as of time of writing, even though
612 # Uint8ClampedArray inherits from Uint8Array, ::set method 605 # Uint8ClampedArray inherits from Uint8Array, ::set method
613 # is not virtual and accessing it through Uint8Array pointer 606 # is not virtual and accessing it through Uint8Array pointer
614 # would lead to wrong semantics (modulo vs. clamping.) 607 # would lead to wrong semantics (modulo vs. clamping.)
615 dart_element_type = self._DartType(element_type) 608 dart_element_type = DartType(element_type)
616 609
617 if self._HasNativeIndexGetter(): 610 if self._HasNativeIndexGetter():
618 self._EmitNativeIndexGetter(dart_element_type) 611 self._EmitNativeIndexGetter(dart_element_type)
619 if self._HasNativeIndexSetter(): 612 if self._HasNativeIndexSetter():
620 self._EmitNativeIndexSetter(dart_element_type) 613 self._EmitNativeIndexSetter(dart_element_type)
621 614
622 def _HasNativeIndexGetter(self): 615 def _HasNativeIndexGetter(self):
623 ext_attrs = self._interface.ext_attrs 616 ext_attrs = self._interface.ext_attrs
624 return ('CustomIndexedGetter' in ext_attrs or 617 return ('CustomIndexedGetter' in ext_attrs or
625 'NumericIndexedGetter' in ext_attrs) 618 'NumericIndexedGetter' in ext_attrs)
626 619
627 def _EmitNativeIndexGetter(self, element_type): 620 def _EmitNativeIndexGetter(self, element_type):
628 dart_declaration = '%s operator[](int index)' % element_type 621 dart_declaration = '%s operator[](int index)' % element_type
629 self._GenerateNativeBinding('numericIndexGetter', 2, dart_declaration, 622 self._GenerateNativeBinding('numericIndexGetter', 2, dart_declaration,
630 'Callback', True) 623 'Callback', True)
631 624
632 def _HasNativeIndexSetter(self): 625 def _HasNativeIndexSetter(self):
633 return 'CustomIndexedSetter' in self._interface.ext_attrs 626 return 'CustomIndexedSetter' in self._interface.ext_attrs
634 627
635 def _EmitNativeIndexSetter(self, element_type): 628 def _EmitNativeIndexSetter(self, element_type):
636 dart_declaration = 'void operator[]=(int index, %s value)' % element_type 629 dart_declaration = 'void operator[]=(int index, %s value)' % element_type
637 self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration, 630 self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration,
638 'Callback', True) 631 'Callback', True)
639 632
640 def _AddOperation(self, info): 633 def AddOperation(self, info, html_name):
641 """ 634 """
642 Arguments: 635 Arguments:
643 info: An OperationInfo object. 636 info: An OperationInfo object.
644 """ 637 """
645 638
646 operation = info.operations[0] 639 operation = info.operations[0]
647 640
648 if 'CheckSecurityForNode' in operation.ext_attrs: 641 if 'CheckSecurityForNode' in operation.ext_attrs:
649 # FIXME: exclude from interface as well. 642 # FIXME: exclude from interface as well.
650 return 643 return
651 644
652 html_name = self._html_system.RenameInHtmlLibrary(
653 self._interface.id, info.name, implementation_class=True)
654
655 if not html_name and info.name == 'item':
656 # FIXME: item should be renamed to operator[], not removed.
657 html_name = '_item'
658
659 if not html_name:
660 return
661
662 is_custom = 'Custom' in operation.ext_attrs 645 is_custom = 'Custom' in operation.ext_attrs
663 has_optional_arguments = any(_IsArgumentOptionalInWebCore(argument) for argu ment in operation.arguments) 646 has_optional_arguments = any(_IsArgumentOptionalInWebCore(argument) for argu ment in operation.arguments)
664 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments) 647 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option al_arguments)
665 648
666 if not needs_dispatcher: 649 if not needs_dispatcher:
667 type_renamer = self._DartType 650 type_renamer = DartType
668 default_value = 'null' 651 default_value = 'null'
669 else: 652 else:
670 type_renamer = lambda x: 'Dynamic' 653 type_renamer = lambda x: 'Dynamic'
671 default_value = '_null' 654 default_value = '_null'
672 655
673 dart_declaration = '%s%s %s(%s)' % ( 656 dart_declaration = '%s%s %s(%s)' % (
674 'static ' if info.IsStatic() else '', 657 'static ' if info.IsStatic() else '',
675 self._DartType(info.type_name), 658 DartType(info.type_name),
676 html_name, 659 html_name,
677 info.ParametersImplementationDeclaration(type_renamer, default_value)) 660 info.ParametersImplementationDeclaration(type_renamer, default_value))
678 661
679 if not needs_dispatcher: 662 if not needs_dispatcher:
680 # Bind directly to native implementation 663 # Bind directly to native implementation
681 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) 664 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos)
682 cpp_callback_name = self._GenerateNativeBinding( 665 cpp_callback_name = self._GenerateNativeBinding(
683 info.name, argument_count, dart_declaration, 'Callback', is_custom) 666 info.name, argument_count, dart_declaration, 'Callback', is_custom)
684 if not is_custom: 667 if not is_custom:
685 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name) 668 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name)
(...skipping 23 matching lines...) Expand all
709 template = ' $CALL;\n' 692 template = ' $CALL;\n'
710 693
711 overload_name = '%s_%s' % (operation.id, version[0]) 694 overload_name = '%s_%s' % (operation.id, version[0])
712 version[0] += 1 695 version[0] += 1
713 argument_list = ', '.join(argument_names[:argument_count]) 696 argument_list = ', '.join(argument_names[:argument_count])
714 call = '_%s(%s)' % (overload_name, argument_list) 697 call = '_%s(%s)' % (overload_name, argument_list)
715 body.Emit(template, CHECKS=' && '.join(checks), CALL=call) 698 body.Emit(template, CHECKS=' && '.join(checks), CALL=call)
716 699
717 dart_declaration = '%s%s _%s(%s)' % ( 700 dart_declaration = '%s%s _%s(%s)' % (
718 'static ' if operation.is_static else '', 701 'static ' if operation.is_static else '',
719 self._DartType(operation.type.id), overload_name, argument_list) 702 DartType(operation.type.id), overload_name, argument_list)
720 cpp_callback_name = self._GenerateNativeBinding( 703 cpp_callback_name = self._GenerateNativeBinding(
721 overload_name, (0 if operation.is_static else 1) + argument_count, 704 overload_name, (0 if operation.is_static else 1) + argument_count,
722 dart_declaration, 'Callback', False) 705 dart_declaration, 'Callback', False)
723 self._GenerateOperationNativeCallback(operation, operation.arguments[:argu ment_count], cpp_callback_name) 706 self._GenerateOperationNativeCallback(operation, operation.arguments[:argu ment_count], cpp_callback_name)
724 707
725 def GenerateChecksAndCall(operation, argument_count): 708 def GenerateChecksAndCall(operation, argument_count):
726 checks = ['%s === _null' % name for name in argument_names] 709 checks = ['%s === _null' % name for name in argument_names]
727 for i in range(0, argument_count): 710 for i in range(0, argument_count):
728 argument = operation.arguments[i] 711 argument = operation.arguments[i]
729 argument_name = argument_names[i] 712 argument_name = argument_names[i]
730 checks[i] = '(%s is %s || %s === null)' % ( 713 checks[i] = '(%s is %s || %s === null)' % (
731 argument_name, self._DartType(argument.type.id), argument_name) 714 argument_name, DartType(argument.type.id), argument_name)
732 GenerateCall(operation, argument_count, checks) 715 GenerateCall(operation, argument_count, checks)
733 716
734 # TODO: Optimize the dispatch to avoid repeated checks. 717 # TODO: Optimize the dispatch to avoid repeated checks.
735 if len(operations) > 1: 718 if len(operations) > 1:
736 for operation in operations: 719 for operation in operations:
737 for position, argument in enumerate(operation.arguments): 720 for position, argument in enumerate(operation.arguments):
738 if _IsArgumentOptionalInWebCore(argument): 721 if _IsArgumentOptionalInWebCore(argument):
739 GenerateChecksAndCall(operation, position) 722 GenerateChecksAndCall(operation, position)
740 GenerateChecksAndCall(operation, len(operation.arguments)) 723 GenerateChecksAndCall(operation, len(operation.arguments))
741 body.Emit(' throw "Incorrect number or type of arguments";\n'); 724 body.Emit(' throw "Incorrect number or type of arguments";\n');
742 else: 725 else:
743 operation = operations[0] 726 operation = operations[0]
744 for position, argument in list(enumerate(operation.arguments))[::-1]: 727 for position, argument in list(enumerate(operation.arguments))[::-1]:
745 if _IsArgumentOptionalInWebCore(argument): 728 if _IsArgumentOptionalInWebCore(argument):
746 check = '%s === _null' % argument_names[position] 729 check = '%s === _null' % argument_names[position]
747 GenerateCall(operation, position, [check]) 730 GenerateCall(operation, position, [check])
748 GenerateCall(operation, len(operation.arguments), []) 731 GenerateCall(operation, len(operation.arguments), [])
749 732
750 def AddOperation(self, info):
751 self._AddOperation(info)
752
753 def AddStaticOperation(self, info):
754 self._AddOperation(info)
755
756 def SecondaryContext(self, interface): 733 def SecondaryContext(self, interface):
757 pass 734 pass
758 735
759 def _GenerateOperationNativeCallback(self, operation, arguments, cpp_callback_ name): 736 def _GenerateOperationNativeCallback(self, operation, arguments, cpp_callback_ name):
760 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d) 737 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d)
761 738
762 parameter_definitions_emitter = emitter.Emitter() 739 parameter_definitions_emitter = emitter.Emitter()
763 cpp_arguments = [] 740 cpp_arguments = []
764 raises_exceptions = self._GenerateCallWithHandling( 741 raises_exceptions = self._GenerateCallWithHandling(
765 operation, parameter_definitions_emitter, cpp_arguments) 742 operation, parameter_definitions_emitter, cpp_arguments)
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 946
970 def _IsArgumentOptionalInWebCore(argument): 947 def _IsArgumentOptionalInWebCore(argument):
971 return IsOptional(argument) and not 'Callback' in argument.ext_attrs 948 return IsOptional(argument) and not 'Callback' in argument.ext_attrs
972 949
973 def _ToWebKitName(name): 950 def _ToWebKitName(name):
974 name = name[0].lower() + name[1:] 951 name = name[0].lower() + name[1:]
975 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), 952 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(),
976 name) 953 name)
977 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() , 954 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() ,
978 name) 955 name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698