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

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

Issue 23817006: Dartium custom element lifecycle event support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/idl/dart/dart.idl ('k') | tools/dom/src/native_DOMImplementation.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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 arguments, 727 arguments,
728 return_type, 728 return_type,
729 return_type_is_nullable, 729 return_type_is_nullable,
730 raises_dom_exception): 730 raises_dom_exception):
731 731
732 ext_attrs = node.ext_attrs 732 ext_attrs = node.ext_attrs
733 733
734 cpp_arguments = [] 734 cpp_arguments = []
735 runtime_check = None 735 runtime_check = None
736 raises_exceptions = raises_dom_exception or arguments 736 raises_exceptions = raises_dom_exception or arguments
737 needs_custom_element_callbacks = False
737 738
738 # TODO(antonm): unify with ScriptState below. 739 # TODO(antonm): unify with ScriptState below.
739 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or 740 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or
740 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts|ScriptState' or 741 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts|ScriptState' or
741 ext_attrs.get('CallWith') == 'ScriptArguments&ScriptS tate' or 742 ext_attrs.get('CallWith') == 'ScriptArguments&ScriptS tate' or
742 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts&ScriptState') 743 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts&ScriptState')
743 if requires_stack_info: 744 if requires_stack_info:
744 raises_exceptions = True 745 raises_exceptions = True
745 cpp_arguments = ['&state', 'scriptArguments.release()'] 746 cpp_arguments = ['&state', 'scriptArguments.release()']
746 # WebKit uses scriptArguments to reconstruct last argument, so 747 # WebKit uses scriptArguments to reconstruct last argument, so
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 cpp_arguments = ['document'] 779 cpp_arguments = ['document']
779 780
780 if 'ImplementedBy' in ext_attrs: 781 if 'ImplementedBy' in ext_attrs:
781 assert needs_receiver 782 assert needs_receiver
782 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy']) 783 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy'])
783 cpp_arguments.append('receiver') 784 cpp_arguments.append('receiver')
784 785
785 if 'Reflect' in ext_attrs: 786 if 'Reflect' in ext_attrs:
786 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)] 787 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)]
787 788
789 if ext_attrs.get('CustomElementCallbacks') == 'Enable':
790 self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"' )
791 needs_custom_element_callbacks = True
792
788 if return_type_is_nullable: 793 if return_type_is_nullable:
789 cpp_arguments = ['isNull'] 794 cpp_arguments = ['isNull']
790 795
791 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext')) 796 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext'))
792 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime')) 797 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime'))
793 assert(not (v8EnabledPerContext and v8EnabledAtRuntime)) 798 assert(not (v8EnabledPerContext and v8EnabledAtRuntime))
794 799
795 if v8EnabledPerContext: 800 if v8EnabledPerContext:
796 raises_exceptions = True 801 raises_exceptions = True
797 self._cpp_impl_includes.add('"ContextFeatures.h"') 802 self._cpp_impl_includes.add('"ContextFeatures.h"')
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 '\n' 905 '\n'
901 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN DEX);\n' 906 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN DEX);\n'
902 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create ScriptArguments(customArgument, exception));\n' 907 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create ScriptArguments(customArgument, exception));\n'
903 ' if (!scriptArguments)\n' 908 ' if (!scriptArguments)\n'
904 ' goto fail;\n' 909 ' goto fail;\n'
905 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n' 910 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n'
906 ' if (!scriptCallStack->size())\n' 911 ' if (!scriptCallStack->size())\n'
907 ' return;\n', 912 ' return;\n',
908 INDEX=len(arguments) + 1) 913 INDEX=len(arguments) + 1)
909 914
915 if needs_custom_element_callbacks:
916 body_emitter.Emit(' CustomElementCallbackDispatcher::CallbackDelive ryScope deliveryScope;\n');
917
910 # Emit arguments. 918 # Emit arguments.
911 start_index = 1 if needs_receiver else 0 919 start_index = 1 if needs_receiver else 0
912 for i, argument in enumerate(arguments): 920 for i, argument in enumerate(arguments):
913 type_info = self._TypeInfo(argument.type.id) 921 type_info = self._TypeInfo(argument.type.id)
914 self._cpp_impl_includes |= set(type_info.conversion_includes()) 922 self._cpp_impl_includes |= set(type_info.conversion_includes())
915 argument_expression_template, type, cls, function = \ 923 argument_expression_template, type, cls, function = \
916 type_info.to_native_info(argument, self._interface.id) 924 type_info.to_native_info(argument, self._interface.id)
917 925
918 def AllowsNull(): 926 def AllowsNull():
919 # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remov e. 927 # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remov e.
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1176 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1169 ' return func;\n', 1177 ' return func;\n',
1170 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1178 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1171 1179
1172 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1180 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1173 return ( 1181 return (
1174 interface.id.endswith('Event') and 1182 interface.id.endswith('Event') and
1175 operation.id.startswith('init') and 1183 operation.id.startswith('init') and
1176 argument.ext_attrs.get('Default') == 'Undefined' and 1184 argument.ext_attrs.get('Default') == 'Undefined' and
1177 argument.type.id == 'DOMString') 1185 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/src/native_DOMImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698