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

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

Issue 25675008: Updating CustomElement lifecycle scope logic (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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr) 547 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, attr)
548 self._GenerateNativeCallback( 548 self._GenerateNativeCallback(
549 cpp_callback_name, 549 cpp_callback_name,
550 True, 550 True,
551 function_expression, 551 function_expression,
552 attr, 552 attr,
553 [attr], 553 [attr],
554 'void', 554 'void',
555 False, 555 False,
556 'SetterRaisesException' in attr.ext_attrs, 556 'SetterRaisesException' in attr.ext_attrs,
557 requires_custom_element_callback=True) 557 generate_custom_element_scope_if_needed=True)
558 558
559 def AddIndexer(self, element_type): 559 def AddIndexer(self, element_type):
560 """Adds all the methods required to complete implementation of List.""" 560 """Adds all the methods required to complete implementation of List."""
561 # We would like to simply inherit the implementation of everything except 561 # We would like to simply inherit the implementation of everything except
562 # length, [], and maybe []=. It is possible to extend from a base 562 # length, [], and maybe []=. It is possible to extend from a base
563 # array implementation class only when there is no other implementation 563 # array implementation class only when there is no other implementation
564 # inheritance. There might be no implementation inheritance other than 564 # inheritance. There might be no implementation inheritance other than
565 # DOMBaseWrapper for many classes, but there might be some where the 565 # DOMBaseWrapper for many classes, but there might be some where the
566 # array-ness is introduced by a non-root interface: 566 # array-ness is introduced by a non-root interface:
567 # 567 #
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d) 716 webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.i d)
717 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, operation, cpp_callback_name) 717 function_expression = self._GenerateWebCoreFunctionExpression(webcore_functi on_name, operation, cpp_callback_name)
718 self._GenerateNativeCallback( 718 self._GenerateNativeCallback(
719 cpp_callback_name, 719 cpp_callback_name,
720 not operation.is_static, 720 not operation.is_static,
721 function_expression, 721 function_expression,
722 operation, 722 operation,
723 arguments, 723 arguments,
724 operation.type.id, 724 operation.type.id,
725 operation.type.nullable, 725 operation.type.nullable,
726 'RaisesException' in operation.ext_attrs) 726 'RaisesException' in operation.ext_attrs,
727 generate_custom_element_scope_if_needed=True)
727 728
728 def _GenerateNativeCallback(self, 729 def _GenerateNativeCallback(self,
729 callback_name, 730 callback_name,
730 needs_receiver, 731 needs_receiver,
731 function_expression, 732 function_expression,
732 node, 733 node,
733 arguments, 734 arguments,
734 return_type, 735 return_type,
735 return_type_is_nullable, 736 return_type_is_nullable,
736 raises_dom_exception, 737 raises_dom_exception,
737 requires_custom_element_callback=False): 738 generate_custom_element_scope_if_needed=False):
738 739
739 ext_attrs = node.ext_attrs 740 ext_attrs = node.ext_attrs
740 741
741 cpp_arguments = [] 742 cpp_arguments = []
742 runtime_check = None 743 runtime_check = None
743 raises_exceptions = raises_dom_exception or arguments 744 raises_exceptions = raises_dom_exception or arguments
744 needs_custom_element_callbacks = False 745 needs_custom_element_callbacks = False
745 746
746 # TODO(antonm): unify with ScriptState below. 747 # TODO(antonm): unify with ScriptState below.
747 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or 748 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 cpp_arguments = ['document'] 787 cpp_arguments = ['document']
787 788
788 if 'ImplementedBy' in ext_attrs: 789 if 'ImplementedBy' in ext_attrs:
789 assert needs_receiver 790 assert needs_receiver
790 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy']) 791 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy'])
791 cpp_arguments.append('receiver') 792 cpp_arguments.append('receiver')
792 793
793 if 'Reflect' in ext_attrs: 794 if 'Reflect' in ext_attrs:
794 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)] 795 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)]
795 796
796 if ext_attrs.get('CustomElementCallbacks') == 'Enable' or requires_custom_el ement_callback: 797 if generate_custom_element_scope_if_needed and (ext_attrs.get('CustomElement Callbacks', 'None') != 'None' or 'Reflect' in ext_attrs):
797 self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"' ) 798 self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"' )
798 needs_custom_element_callbacks = True 799 needs_custom_element_callbacks = True
799 800
800 if return_type_is_nullable: 801 if return_type_is_nullable:
801 cpp_arguments = ['isNull'] 802 cpp_arguments = ['isNull']
802 803
803 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext')) 804 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext'))
804 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime')) 805 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime'))
805 assert(not (v8EnabledPerContext and v8EnabledAtRuntime)) 806 assert(not (v8EnabledPerContext and v8EnabledAtRuntime))
806 807
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1184 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1184 ' return func;\n', 1185 ' return func;\n',
1185 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1186 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1186 1187
1187 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1188 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1188 return ( 1189 return (
1189 interface.id.endswith('Event') and 1190 interface.id.endswith('Event') and
1190 operation.id.startswith('init') and 1191 operation.id.startswith('init') and
1191 argument.ext_attrs.get('Default') == 'Undefined' and 1192 argument.ext_attrs.get('Default') == 'Undefined' and
1192 argument.type.id == 'DOMString') 1193 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