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

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

Issue 841973002: IDL: Support iterable<>, maplike<> and setlike<> syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 is_active_dom_object = 'ActiveDOMObject' in extended_attributes 117 is_active_dom_object = 'ActiveDOMObject' in extended_attributes
118 118
119 # [CheckSecurity] 119 # [CheckSecurity]
120 is_check_security = 'CheckSecurity' in extended_attributes 120 is_check_security = 'CheckSecurity' in extended_attributes
121 if is_check_security: 121 if is_check_security:
122 includes.add('bindings/core/v8/BindingSecurity.h') 122 includes.add('bindings/core/v8/BindingSecurity.h')
123 123
124 # [DependentLifetime] 124 # [DependentLifetime]
125 is_dependent_lifetime = 'DependentLifetime' in extended_attributes 125 is_dependent_lifetime = 'DependentLifetime' in extended_attributes
126 126
127 # [Iterable] 127 # [Iterable], iterable<>, maplike<> and setlike<>
128 iterator_method = None 128 iterator_method = None
129 # FIXME: support Iterable in partial interfaces. However, we don't 129 # FIXME: support Iterable in partial interfaces. However, we don't
130 # need to support iterator overloads between interface and 130 # need to support iterator overloads between interface and
131 # partial interface definitions. 131 # partial interface definitions.
132 # http://heycam.github.io/webidl/#idl-overloading 132 # http://heycam.github.io/webidl/#idl-overloading
133 if 'Iterable' in extended_attributes and not interface.is_partial: 133 if (not interface.is_partial
134 and (interface.iterable or interface.maplike or interface.setlike
135 or 'Iterable' in extended_attributes)):
134 iterator_operation = IdlOperation(interface.idl_name) 136 iterator_operation = IdlOperation(interface.idl_name)
135 iterator_operation.name = 'iterator' 137 iterator_operation.name = 'iterator'
136 iterator_operation.idl_type = IdlType('Iterator') 138 iterator_operation.idl_type = IdlType('Iterator')
137 iterator_operation.extended_attributes['RaisesException'] = None 139 iterator_operation.extended_attributes['RaisesException'] = None
jsbell 2015/01/08 17:02:40 Will it be possible (not in this CL, but w/o signi
Jens Widell 2015/01/08 17:12:04 Supporting extended attributes, and simply transfe
jsbell 2015/01/08 18:24:49 Noted. FWIW, applying the same attribs to all of
Jens Widell 2015/01/13 10:26:26 Having thought some more about this, one IMO rathe
138 iterator_operation.extended_attributes['CallWith'] = 'ScriptState' 140 iterator_operation.extended_attributes['CallWith'] = 'ScriptState'
139 iterator_method = v8_methods.method_context(interface, 141 iterator_method = v8_methods.method_context(interface,
140 iterator_operation) 142 iterator_operation)
143 # FIXME: iterable<>, maplike<> and setlike<> should also imply the
144 # presence of a subset of keys(), values(), entries(), forEach(), has(),
145 # get(), add(), set(), delete() and clear(), and a 'size' attribute.
141 146
142 # [MeasureAs] 147 # [MeasureAs]
143 is_measure_as = 'MeasureAs' in extended_attributes 148 is_measure_as = 'MeasureAs' in extended_attributes
144 if is_measure_as: 149 if is_measure_as:
145 includes.add('core/frame/UseCounter.h') 150 includes.add('core/frame/UseCounter.h')
146 151
147 # [SetWrapperReferenceFrom] 152 # [SetWrapperReferenceFrom]
148 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') 153 reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom')
149 if reachable_node_function: 154 if reachable_node_function:
150 includes.update(['bindings/core/v8/V8GCController.h', 155 includes.update(['bindings/core/v8/V8GCController.h',
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 deleter = next( 1268 deleter = next(
1264 method 1269 method
1265 for method in interface.operations 1270 for method in interface.operations
1266 if ('deleter' in method.specials and 1271 if ('deleter' in method.specials and
1267 len(method.arguments) == 1 and 1272 len(method.arguments) == 1 and
1268 str(method.arguments[0].idl_type) == 'DOMString')) 1273 str(method.arguments[0].idl_type) == 'DOMString'))
1269 except StopIteration: 1274 except StopIteration:
1270 return None 1275 return None
1271 1276
1272 return property_deleter(deleter) 1277 return property_deleter(deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698