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

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
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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 arguments, 702 arguments,
703 return_type, 703 return_type,
704 return_type_is_nullable, 704 return_type_is_nullable,
705 raises_dom_exception): 705 raises_dom_exception):
706 706
707 ext_attrs = node.ext_attrs 707 ext_attrs = node.ext_attrs
708 708
709 cpp_arguments = [] 709 cpp_arguments = []
710 runtime_check = None 710 runtime_check = None
711 raises_exceptions = raises_dom_exception or arguments 711 raises_exceptions = raises_dom_exception or arguments
712 needs_custom_element_callbacks = False
712 713
713 # TODO(antonm): unify with ScriptState below. 714 # TODO(antonm): unify with ScriptState below.
714 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or 715 requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptS tate' or
715 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts|ScriptState' or 716 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts|ScriptState' or
716 ext_attrs.get('CallWith') == 'ScriptArguments&ScriptS tate' or 717 ext_attrs.get('CallWith') == 'ScriptArguments&ScriptS tate' or
717 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts&ScriptState') 718 ext_attrs.get('ConstructorCallWith') == 'ScriptArgume nts&ScriptState')
718 if requires_stack_info: 719 if requires_stack_info:
719 raises_exceptions = True 720 raises_exceptions = True
720 cpp_arguments = ['&state', 'scriptArguments.release()'] 721 cpp_arguments = ['&state', 'scriptArguments.release()']
721 # WebKit uses scriptArguments to reconstruct last argument, so 722 # WebKit uses scriptArguments to reconstruct last argument, so
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 cpp_arguments = ['document'] 754 cpp_arguments = ['document']
754 755
755 if 'ImplementedBy' in ext_attrs: 756 if 'ImplementedBy' in ext_attrs:
756 assert needs_receiver 757 assert needs_receiver
757 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy']) 758 self._cpp_impl_includes.add('"%s.h"' % ext_attrs['ImplementedBy'])
758 cpp_arguments.append('receiver') 759 cpp_arguments.append('receiver')
759 760
760 if 'Reflect' in ext_attrs: 761 if 'Reflect' in ext_attrs:
761 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)] 762 cpp_arguments = [self._GenerateWebCoreReflectionAttributeName(node)]
762 763
764 if ext_attrs.get('CustomElementCallbacks') == 'Enable':
765 self._cpp_impl_includes.add('"core/dom/CustomElementCallbackDispatcher.h"' )
766 needs_custom_element_callbacks = True
767
763 if return_type_is_nullable: 768 if return_type_is_nullable:
764 cpp_arguments = ['isNull'] 769 cpp_arguments = ['isNull']
765 770
766 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext')) 771 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext'))
767 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime')) 772 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime'))
768 assert(not (v8EnabledPerContext and v8EnabledAtRuntime)) 773 assert(not (v8EnabledPerContext and v8EnabledAtRuntime))
769 774
770 if v8EnabledPerContext: 775 if v8EnabledPerContext:
771 raises_exceptions = True 776 raises_exceptions = True
772 self._cpp_impl_includes.add('"ContextFeatures.h"') 777 self._cpp_impl_includes.add('"ContextFeatures.h"')
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 '\n' 880 '\n'
876 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN DEX);\n' 881 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN DEX);\n'
877 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create ScriptArguments(customArgument, exception));\n' 882 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create ScriptArguments(customArgument, exception));\n'
878 ' if (!scriptArguments)\n' 883 ' if (!scriptArguments)\n'
879 ' goto fail;\n' 884 ' goto fail;\n'
880 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n' 885 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n'
881 ' if (!scriptCallStack->size())\n' 886 ' if (!scriptCallStack->size())\n'
882 ' return;\n', 887 ' return;\n',
883 INDEX=len(arguments) + 1) 888 INDEX=len(arguments) + 1)
884 889
890 if needs_custom_element_callbacks:
891 body_emitter.Emit(' CustomElementCallbackDispatcher::CallbackDelive ryScope deliveryScope;\n');
892
885 # Emit arguments. 893 # Emit arguments.
886 start_index = 1 if needs_receiver else 0 894 start_index = 1 if needs_receiver else 0
887 for i, argument in enumerate(arguments): 895 for i, argument in enumerate(arguments):
888 type_info = self._TypeInfo(argument.type.id) 896 type_info = self._TypeInfo(argument.type.id)
889 self._cpp_impl_includes |= set(type_info.conversion_includes()) 897 self._cpp_impl_includes |= set(type_info.conversion_includes())
890 argument_expression_template, type, cls, function = \ 898 argument_expression_template, type, cls, function = \
891 type_info.to_native_info(argument, self._interface.id) 899 type_info.to_native_info(argument, self._interface.id)
892 900
893 def AllowsNull(): 901 def AllowsNull():
894 # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remov e. 902 # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remov e.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1146 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
1139 ' return func;\n', 1147 ' return func;\n',
1140 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1148 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1141 1149
1142 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1150 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1143 return ( 1151 return (
1144 interface.id.endswith('Event') and 1152 interface.id.endswith('Event') and
1145 operation.id.startswith('init') and 1153 operation.id.startswith('init') and
1146 argument.ext_attrs.get('Default') == 'Undefined' and 1154 argument.ext_attrs.get('Default') == 'Undefined' and
1147 argument.type.id == 'DOMString') 1155 argument.type.id == 'DOMString')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698