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

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

Issue 25666008: Adding custom element lifecycle processing to all attribute modifiers. (Closed) Base URL: https://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 | « no previous file | no next file » | 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr) 545 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr)
546 self._GenerateNativeCallback( 546 self._GenerateNativeCallback(
547 cpp_callback_name, 547 cpp_callback_name,
548 True, 548 True,
549 function_expression, 549 function_expression,
550 attr, 550 attr,
551 [attr], 551 [attr],
552 'void', 552 'void',
553 False, 553 False,
554 'SetterRaisesException' in attr.ext_attrs) 554 'SetterRaisesException' in attr.ext_attrs,
555 requires_custom_element_callback=True)
555 556
556 def AddIndexer(self, element_type): 557 def AddIndexer(self, element_type):
557 """Adds all the methods required to complete implementation of List.""" 558 """Adds all the methods required to complete implementation of List."""
558 # We would like to simply inherit the implementation of everything except 559 # We would like to simply inherit the implementation of everything except
559 # length, [], and maybe []=. It is possible to extend from a base 560 # length, [], and maybe []=. It is possible to extend from a base
560 # array implementation class only when there is no other implementation 561 # array implementation class only when there is no other implementation
561 # inheritance. There might be no implementation inheritance other than 562 # inheritance. There might be no implementation inheritance other than
562 # DOMBaseWrapper for many classes, but there might be some where the 563 # DOMBaseWrapper for many classes, but there might be some where the
563 # array-ness is introduced by a non-root interface: 564 # array-ness is introduced by a non-root interface:
564 # 565 #
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 'RaisesException' in operation.ext_attrs) 724 'RaisesException' in operation.ext_attrs)
724 725
725 def _GenerateNativeCallback(self, 726 def _GenerateNativeCallback(self,
726 callback_name, 727 callback_name,
727 needs_receiver, 728 needs_receiver,
728 function_expression, 729 function_expression,
729 node, 730 node,
730 arguments, 731 arguments,
731 return_type, 732 return_type,
732 return_type_is_nullable, 733 return_type_is_nullable,
733 raises_dom_exception): 734 raises_dom_exception,
735 requires_custom_element_callback=False):
734 736
735 ext_attrs = node.ext_attrs 737 ext_attrs = node.ext_attrs
736 738
737 cpp_arguments = [] 739 cpp_arguments = []
738 runtime_check = None 740 runtime_check = None
739 raises_exceptions = raises_dom_exception or arguments 741 raises_exceptions = raises_dom_exception or arguments
740 needs_custom_element_callbacks = False 742 needs_custom_element_callbacks = False
741 743
742 # TODO(antonm): unify with ScriptState below. 744 # TODO(antonm): unify with ScriptState below.
743 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or 745 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 cpp_arguments = ['document'] 784 cpp_arguments = ['document']
783 785
784 if 'ImplementedBy' in ext_attrs: 786 if 'ImplementedBy' in ext_attrs:
785 assert needs_receiver 787 assert needs_receiver
786 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy']) 788 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy'])
787 cpp_arguments.append('receiver') 789 cpp_arguments.append('receiver')
788 790
789 if 'Reflect' in ext_attrs: 791 if 'Reflect' in ext_attrs:
790 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)] 792 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)]
791 793
792 if ext_attrs.get('CustomElementCallbacks') == 'Enable': 794 if ext_attrs.get('CustomElementCallbacks') == 'Enable' or requires_custom_el ement_callback:
793 self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"' ) 795 self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"' )
794 needs_custom_element_callbacks = True 796 needs_custom_element_callbacks = True
795 797
796 if return_type_is_nullable: 798 if return_type_is_nullable:
797 cpp_arguments = ['isNull'] 799 cpp_arguments = ['isNull']
798 800
799 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext')) 801 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext'))
800 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime')) 802 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime'))
801 assert(not (v8EnabledPerContext and v8EnabledAtRuntime)) 803 assert(not (v8EnabledPerContext and v8EnabledAtRuntime))
802 804
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1181 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1180 ' return func;\n', 1182 ' return func;\n',
1181 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1183 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1182 1184
1183 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1185 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1184 return ( 1186 return (
1185 interface.id.endswith('Event') and 1187 interface.id.endswith('Event') and
1186 operation.id.startswith('init') and 1188 operation.id.startswith('init') and
1187 argument.ext_attrs.get('Default') == 'Undefined' and 1189 argument.ext_attrs.get('Default') == 'Undefined' and
1188 argument.type.id == 'DOMString') 1190 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698