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

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: Created 6 years, 4 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 is_active_dom_object = 'ActiveDOMObject' in extended_attributes 94 is_active_dom_object = 'ActiveDOMObject' in extended_attributes
95 95
96 # [CheckSecurity] 96 # [CheckSecurity]
97 is_check_security = 'CheckSecurity' in extended_attributes 97 is_check_security = 'CheckSecurity' in extended_attributes
98 if is_check_security: 98 if is_check_security:
99 includes.add('bindings/core/v8/BindingSecurity.h') 99 includes.add('bindings/core/v8/BindingSecurity.h')
100 100
101 # [DependentLifetime] 101 # [DependentLifetime]
102 is_dependent_lifetime = 'DependentLifetime' in extended_attributes 102 is_dependent_lifetime = 'DependentLifetime' in extended_attributes
103 103
104 # [Iterable]
105 is_iterable = 'Iterable' in extended_attributes
106 iterator_method = None
107 if is_iterable:
108 includes.add('bindings/core/v8/V8Iterator.h')
Jens Widell 2014/08/21 13:58:01 Is this needed? I thought it was at first, but the
yhirano 2014/08/25 06:09:26 You're right, thanks!
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
104 # [MeasureAs] 117 # [MeasureAs]
105 is_measure_as = 'MeasureAs' in extended_attributes 118 is_measure_as = 'MeasureAs' in extended_attributes
106 if is_measure_as: 119 if is_measure_as:
107 includes.add('core/frame/UseCounter.h') 120 includes.add('core/frame/UseCounter.h')
108 121
109 # [SetWrapperReferenceFrom] 122 # [SetWrapperReferenceFrom]
110 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') 123 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom')
111 if reachable_node_function: 124 if reachable_node_function:
112 includes.update(['bindings/core/v8/V8GCController.h', 125 includes.update(['bindings/core/v8/V8GCController.h',
113 'core/dom/Element.h']) 126 'core/dom/Element.h'])
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 'has_visit_dom_wrapper': has_visit_dom_wrapper, 165 'has_visit_dom_wrapper': has_visit_dom_wrapper,
153 'header_includes': header_includes, 166 'header_includes': header_includes,
154 'interface_name': interface.name, 167 'interface_name': interface.name,
155 'is_active_dom_object': is_active_dom_object, 168 'is_active_dom_object': is_active_dom_object,
156 'is_audio_buffer': is_audio_buffer, 169 'is_audio_buffer': is_audio_buffer,
157 'is_check_security': is_check_security, 170 'is_check_security': is_check_security,
158 'is_dependent_lifetime': is_dependent_lifetime, 171 'is_dependent_lifetime': is_dependent_lifetime,
159 'is_document': is_document, 172 'is_document': is_document,
160 'is_event_target': inherits_interface(interface.name, 'EventTarget'), 173 'is_event_target': inherits_interface(interface.name, 'EventTarget'),
161 'is_exception': interface.is_exception, 174 'is_exception': interface.is_exception,
175 'is_iterable': is_iterable,
Jens Widell 2014/08/21 13:58:02 I'd slightly prefer if we dropped this and just us
yhirano 2014/08/25 06:09:26 Done.
162 'is_node': inherits_interface(interface.name, 'Node'), 176 'is_node': inherits_interface(interface.name, 'Node'),
177 'iterator_method': iterator_method,
163 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] 178 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs]
164 'parent_interface': parent_interface, 179 'parent_interface': parent_interface,
165 'pass_cpp_type': cpp_template_type( 180 'pass_cpp_type': cpp_template_type(
166 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), 181 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type),
167 cpp_name(interface)), 182 cpp_name(interface)),
168 'reachable_node_function': reachable_node_function, 183 'reachable_node_function': reachable_node_function,
169 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled] 184 'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled]
170 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, 185 'set_wrapper_reference_to_list': set_wrapper_reference_to_list,
171 'special_wrap_for': special_wrap_for, 186 'special_wrap_for': special_wrap_for,
172 'v8_class': v8_utilities.v8_class_name(interface), 187 'v8_class': v8_utilities.v8_class_name(interface),
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 deleter = next( 1125 deleter = next(
1111 method 1126 method
1112 for method in interface.operations 1127 for method in interface.operations
1113 if ('deleter' in method.specials and 1128 if ('deleter' in method.specials and
1114 len(method.arguments) == 1 and 1129 len(method.arguments) == 1 and
1115 str(method.arguments[0].idl_type) == 'DOMString')) 1130 str(method.arguments[0].idl_type) == 'DOMString'))
1116 except StopIteration: 1131 except StopIteration:
1117 return None 1132 return None
1118 1133
1119 return property_deleter(deleter) 1134 return property_deleter(deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698