Chromium Code Reviews

Side by Side Diff: Source/bindings/scripts/v8_interface.py

Issue 483163003: Introduce ES6 iterator for DOM objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 85 matching lines...)
96 is_active_dom_object = 'ActiveDOMObject' in extended_attributes 96 is_active_dom_object = 'ActiveDOMObject' in extended_attributes
97 97
98 # [CheckSecurity] 98 # [CheckSecurity]
99 is_check_security = 'CheckSecurity' in extended_attributes 99 is_check_security = 'CheckSecurity' in extended_attributes
100 if is_check_security: 100 if is_check_security:
101 includes.add('bindings/core/v8/BindingSecurity.h') 101 includes.add('bindings/core/v8/BindingSecurity.h')
102 102
103 # [DependentLifetime] 103 # [DependentLifetime]
104 is_dependent_lifetime = 'DependentLifetime' in extended_attributes 104 is_dependent_lifetime = 'DependentLifetime' in extended_attributes
105 105
106 # [Iterable]
107 iterator_method = None
108 if 'Iterable' in extended_attributes:
109 iterator_operation = IdlOperation(interface.idl_name)
110 iterator_operation.name = 'iterator'
111 iterator_operation.idl_type = IdlType('Iterator')
112 iterator_operation.extended_attributes['RaisesException'] = None
113 iterator_operation.extended_attributes['CallWith'] = 'ScriptState'
114 iterator_method = v8_methods.method_context(interface,
115 iterator_operation)
116
106 # [MeasureAs] 117 # [MeasureAs]
107 is_measure_as = 'MeasureAs' in extended_attributes 118 is_measure_as = 'MeasureAs' in extended_attributes
108 if is_measure_as: 119 if is_measure_as:
109 includes.add('core/frame/UseCounter.h') 120 includes.add('core/frame/UseCounter.h')
110 121
111 # [SetWrapperReferenceFrom] 122 # [SetWrapperReferenceFrom]
112 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') 123 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom')
113 if reachable_node_function: 124 if reachable_node_function:
114 includes.update(['bindings/core/v8/V8GCController.h', 125 includes.update(['bindings/core/v8/V8GCController.h',
115 'core/dom/Element.h']) 126 'core/dom/Element.h'])
(...skipping 43 matching lines...)
159 'header_includes': header_includes, 170 'header_includes': header_includes,
160 'interface_name': interface.name, 171 'interface_name': interface.name,
161 'is_active_dom_object': is_active_dom_object, 172 'is_active_dom_object': is_active_dom_object,
162 'is_audio_buffer': is_audio_buffer, 173 'is_audio_buffer': is_audio_buffer,
163 'is_check_security': is_check_security, 174 'is_check_security': is_check_security,
164 'is_dependent_lifetime': is_dependent_lifetime, 175 'is_dependent_lifetime': is_dependent_lifetime,
165 'is_document': is_document, 176 'is_document': is_document,
166 'is_event_target': inherits_interface(interface.name, 'EventTarget'), 177 'is_event_target': inherits_interface(interface.name, 'EventTarget'),
167 'is_exception': interface.is_exception, 178 'is_exception': interface.is_exception,
168 'is_node': inherits_interface(interface.name, 'Node'), 179 'is_node': inherits_interface(interface.name, 'Node'),
180 'iterator_method': iterator_method,
169 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] 181 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs]
170 'parent_interface': parent_interface, 182 'parent_interface': parent_interface,
171 'pass_cpp_type': cpp_template_type( 183 'pass_cpp_type': cpp_template_type(
172 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), 184 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type),
173 cpp_name(interface)), 185 cpp_name(interface)),
174 'reachable_node_function': reachable_node_function, 186 'reachable_node_function': reachable_node_function,
175 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled] 187 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled]
176 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, 188 'set_wrapper_reference_to_list': set_wrapper_reference_to_list,
177 'special_wrap_for': special_wrap_for, 189 'special_wrap_for': special_wrap_for,
178 'v8_class': v8_utilities.v8_class_name(interface), 190 'v8_class': v8_utilities.v8_class_name(interface),
(...skipping 941 matching lines...)
1120 deleter = next( 1132 deleter = next(
1121 method 1133 method
1122 for method in interface.operations 1134 for method in interface.operations
1123 if ('deleter' in method.specials and 1135 if ('deleter' in method.specials and
1124 len(method.arguments) == 1 and 1136 len(method.arguments) == 1 and
1125 str(method.arguments[0].idl_type) == 'DOMString')) 1137 str(method.arguments[0].idl_type) == 'DOMString'))
1126 except StopIteration: 1138 except StopIteration:
1127 return None 1139 return None
1128 1140
1129 return property_deleter(deleter) 1141 return property_deleter(deleter)
OLDNEW

Powered by Google App Engine