OLD | NEW |
1 {% include 'copyright_block.txt' %} | 1 {% include 'copyright_block.txt' %} |
2 #include "{{v8_class_or_partial}}.h" | 2 #include "{{v8_class_or_partial}}.h" |
3 | 3 |
4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} | 4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
5 #include "{{filename}}" | 5 #include "{{filename}}" |
6 {% endfor %} | 6 {% endfor %} |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class | 9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class |
10 if active_scriptwrappable else '0' %} | 10 if active_scriptwrappable else '0' %} |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 {% endif %} | 114 {% endif %} |
115 {% endblock %} | 115 {% endblock %} |
116 {##############################################################################} | 116 {##############################################################################} |
117 {# Methods #} | 117 {# Methods #} |
118 {% from 'methods.cpp' import generate_method, overload_resolution_method, | 118 {% from 'methods.cpp' import generate_method, overload_resolution_method, |
119 method_callback, origin_safe_method_getter, generate_constructor, | 119 method_callback, origin_safe_method_getter, generate_constructor, |
120 method_implemented_in_private_script, generate_post_message_impl, | 120 method_implemented_in_private_script, generate_post_message_impl, |
121 runtime_determined_length_method, runtime_determined_maxarg_method | 121 runtime_determined_length_method, runtime_determined_maxarg_method |
122 with context %} | 122 with context %} |
123 {% for method in methods %} | 123 {% for method in methods if method.should_be_exposed_to_script %} |
124 {% if method.should_be_exposed_to_script %} | |
125 {% for world_suffix in method.world_suffixes %} | 124 {% for world_suffix in method.world_suffixes %} |
126 {% if not method.is_custom and not method.is_post_message and method.visible %} | 125 {% if not method.is_custom and not method.is_post_message and method.visible %} |
127 {{generate_method(method, world_suffix)}} | 126 {{generate_method(method, world_suffix)}} |
128 {% endif %} | 127 {% endif %} |
129 {% if method.is_post_message %} | 128 {% if method.is_post_message %} |
130 {{generate_post_message_impl()}} | 129 {{generate_post_message_impl()}} |
131 {% endif %} | 130 {% endif %} |
132 {% if method.overloads and method.overloads.visible %} | 131 {% if method.overloads and method.overloads.visible %} |
133 {% if method.overloads.runtime_determined_lengths %} | 132 {% if method.overloads.runtime_determined_lengths %} |
134 {{runtime_determined_length_method(method.overloads)}} | 133 {{runtime_determined_length_method(method.overloads)}} |
(...skipping 11 matching lines...) Expand all Loading... |
146 (not method.overloads and method.visible) %} | 145 (not method.overloads and method.visible) %} |
147 {# A single callback is generated for overloaded methods #} | 146 {# A single callback is generated for overloaded methods #} |
148 {# with considering partial overloads #} | 147 {# with considering partial overloads #} |
149 {{method_callback(method, world_suffix)}} | 148 {{method_callback(method, world_suffix)}} |
150 {% endif %} | 149 {% endif %} |
151 {% endif %} | 150 {% endif %} |
152 {% if method.is_do_not_check_security and method.visible %} | 151 {% if method.is_do_not_check_security and method.visible %} |
153 {{origin_safe_method_getter(method, world_suffix)}} | 152 {{origin_safe_method_getter(method, world_suffix)}} |
154 {% endif %} | 153 {% endif %} |
155 {% endfor %} | 154 {% endfor %} |
156 {% endif %} | |
157 {% endfor %} | 155 {% endfor %} |
158 {% if iterator_method %} | 156 {% if iterator_method %} |
159 {{generate_method(iterator_method)}} | 157 {{generate_method(iterator_method)}} |
160 {{method_callback(iterator_method)}} | 158 {{method_callback(iterator_method)}} |
161 {% endif %} | 159 {% endif %} |
162 {% block origin_safe_method_setter %}{% endblock %} | 160 {% block origin_safe_method_setter %}{% endblock %} |
163 {# Constructors #} | 161 {# Constructors #} |
164 {% for constructor in constructors %} | 162 {% for constructor in constructors %} |
165 {{generate_constructor(constructor)}} | 163 {{generate_constructor(constructor)}} |
166 {% endfor %} | 164 {% endfor %} |
(...skipping 15 matching lines...) Expand all Loading... |
182 {% block named_property_deleter %}{% endblock %} | 180 {% block named_property_deleter %}{% endblock %} |
183 {% block named_property_deleter_callback %}{% endblock %} | 181 {% block named_property_deleter_callback %}{% endblock %} |
184 {% block named_property_enumerator %}{% endblock %} | 182 {% block named_property_enumerator %}{% endblock %} |
185 {% block named_property_enumerator_callback %}{% endblock %} | 183 {% block named_property_enumerator_callback %}{% endblock %} |
186 } // namespace {{cpp_class_or_partial}}V8Internal | 184 } // namespace {{cpp_class_or_partial}}V8Internal |
187 | 185 |
188 {% block visit_dom_wrapper %}{% endblock %} | 186 {% block visit_dom_wrapper %}{% endblock %} |
189 {##############################################################################} | 187 {##############################################################################} |
190 {% block install_attributes %} | 188 {% block install_attributes %} |
191 {% from 'attributes.cpp' import attribute_configuration with context %} | 189 {% from 'attributes.cpp' import attribute_configuration with context %} |
192 {% if has_attribute_configuration %} | 190 {% if attributes | has_attribute_configuration %} |
193 // Suppress warning: global constructors, because AttributeConfiguration is triv
ial | 191 // Suppress warning: global constructors, because AttributeConfiguration is triv
ial |
194 // and does not depend on another global objects. | 192 // and does not depend on another global objects. |
195 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 193 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
196 #pragma clang diagnostic push | 194 #pragma clang diagnostic push |
197 #pragma clang diagnostic ignored "-Wglobal-constructors" | 195 #pragma clang diagnostic ignored "-Wglobal-constructors" |
198 #endif | 196 #endif |
199 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { | 197 const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { |
200 {% for attribute in attributes | 198 {% for attribute in attributes | has_attribute_configuration %} |
201 if not (attribute.exposed_test or | |
202 attribute.runtime_enabled_function) and | |
203 attribute.is_data_type_property and | |
204 attribute.should_be_exposed_to_script %} | |
205 {{attribute_configuration(attribute)}}, | 199 {{attribute_configuration(attribute)}}, |
206 {% endfor %} | 200 {% endfor %} |
207 }; | 201 }; |
208 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 202 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
209 #pragma clang diagnostic pop | 203 #pragma clang diagnostic pop |
210 #endif | 204 #endif |
211 | 205 |
212 {% endif %} | 206 {% endif %} |
213 {% endblock %} | 207 {% endblock %} |
214 {##############################################################################} | 208 {##############################################################################} |
215 {% block install_accessors %} | 209 {% block install_accessors %} |
216 {% from 'attributes.cpp' import attribute_configuration with context %} | 210 {% from 'attributes.cpp' import attribute_configuration with context %} |
217 {% if has_accessor_configuration %} | 211 {% if attributes | has_accessor_configuration %} |
218 const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { | 212 const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { |
219 {% for attribute in attributes | 213 {% for attribute in attributes | has_accessor_configuration %} |
220 if not (attribute.exposed_test or | |
221 attribute.runtime_enabled_function) and | |
222 not attribute.is_data_type_property and | |
223 attribute.should_be_exposed_to_script %} | |
224 {{attribute_configuration(attribute)}}, | 214 {{attribute_configuration(attribute)}}, |
225 {% endfor %} | 215 {% endfor %} |
226 }; | 216 }; |
227 | 217 |
228 {% endif %} | 218 {% endif %} |
229 {% endblock %} | 219 {% endblock %} |
230 {##############################################################################} | 220 {##############################################################################} |
231 {% block install_methods %} | 221 {% block install_methods %} |
232 {% from 'methods.cpp' import method_configuration with context %} | 222 {% from 'methods.cpp' import method_configuration with context %} |
233 {% if method_configuration_methods %} | 223 {% if method_configuration_methods %} |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); | 267 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); |
278 ALLOW_UNUSED_LOCAL(instanceTemplate); | 268 ALLOW_UNUSED_LOCAL(instanceTemplate); |
279 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); | 269 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); |
280 ALLOW_UNUSED_LOCAL(prototypeTemplate); | 270 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
281 | 271 |
282 {%- if interface_name == 'Window' and not is_partial %}{{newline}} | 272 {%- if interface_name == 'Window' and not is_partial %}{{newline}} |
283 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 273 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
284 {% endif %} | 274 {% endif %} |
285 | 275 |
286 // Register DOM constants, attributes and operations. | 276 // Register DOM constants, attributes and operations. |
287 {% if runtime_enabled_function %} | 277 {% filter runtime_enabled(runtime_enabled_function) %} |
288 if ({{runtime_enabled_function}}()) { | |
289 {% endif %} | |
290 {% filter indent(4 if runtime_enabled_function else 0, true) %} | |
291 {% if constants %} | 278 {% if constants %} |
292 {{install_constants() | indent}} | 279 {{install_constants() | indent}} |
293 {% endif %} | 280 {% endif %} |
294 {% if has_attribute_configuration %} | 281 {% if attributes | has_attribute_configuration %} |
295 V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, prot
otypeTemplate, {{'%sAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH(%sAttributes)'
% v8_class}}); | 282 V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, prot
otypeTemplate, {{'%sAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH(%sAttributes)'
% v8_class}}); |
296 {% endif %} | 283 {% endif %} |
297 {% if has_accessor_configuration %} | 284 {% if attributes | has_accessor_configuration %} |
298 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, proto
typeTemplate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF
_ARRAY_LENGTH(%sAccessors)' % v8_class}}); | 285 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, proto
typeTemplate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF
_ARRAY_LENGTH(%sAccessors)' % v8_class}}); |
299 {% endif %} | 286 {% endif %} |
300 {% if method_configuration_methods %} | 287 {% if method_configuration_methods %} |
301 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototy
peTemplate, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARR
AY_LENGTH(%sMethods)' % v8_class}}); | 288 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototy
peTemplate, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARR
AY_LENGTH(%sMethods)' % v8_class}}); |
302 {% endif %} | 289 {% endif %} |
303 {% endfilter %}{{newline}} | 290 {% endfilter %} |
304 {% if runtime_enabled_function %} | |
305 } // if ({{runtime_enabled_function}}()) | |
306 {% endif %} | |
307 | |
308 {%- if has_access_check_callbacks and not is_partial %}{{newline}} | 291 {%- if has_access_check_callbacks and not is_partial %}{{newline}} |
309 // Cross-origin access check | 292 // Cross-origin access check |
310 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh
eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap
perTypeInfo))); | 293 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh
eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap
perTypeInfo))); |
311 {% endif %} | 294 {% endif %} |
312 | 295 |
313 {%- if has_array_iterator and not is_partial and not is_global %}{{newline}} | 296 {%- if has_array_iterator and not is_partial and not is_global %}{{newline}} |
314 // Array iterator | 297 // Array iterator |
315 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate)
, v8::kArrayProto_values, v8::DontEnum); | 298 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate)
, v8::kArrayProto_values, v8::DontEnum); |
316 {% endif %} | 299 {% endif %} |
317 | 300 |
318 {%- set runtime_enabled_features = dict() %} | 301 {%- for group in attributes | runtime_enabled_attributes | groupby('runtime_
feature_name') %}{{newline}} |
319 {% for attribute in attributes | 302 if ({{group.list[0].runtime_enabled_function}}()) { |
320 if attribute.runtime_enabled_function and | 303 {% for attribute in group.list | unique_by('name') | sort %} |
321 not attribute.exposed_test %} | |
322 {% if attribute.runtime_enabled_function not in runtime_enabled_features
%} | |
323 {% set unused = runtime_enabled_features.update({attribute.runtime_e
nabled_function: []}) %} | |
324 {% endif %} | |
325 {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_f
unction).append(attribute) %} | |
326 {% endfor %} | |
327 {% for runtime_enabled_feature in runtime_enabled_features | sort %}{{newlin
e}} | |
328 if ({{runtime_enabled_feature}}()) { | |
329 {% set distinct_attributes = [] %} | |
330 {% for attribute in runtime_enabled_features.get(runtime_enabled_feature
) | sort | |
331 if attribute.name not in distinct_attributes %} | |
332 {% set unused = distinct_attributes.append(attribute.name) %} | |
333 {% if attribute.is_data_type_property %} | 304 {% if attribute.is_data_type_property %} |
334 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.na
me}}Configuration = \ | 305 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.na
me}}Configuration = \ |
335 {{attribute_configuration(attribute)}}; | 306 {{attribute_configuration(attribute)}}; |
336 V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, p
rototypeTemplate, attribute{{attribute.name}}Configuration); | 307 V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, p
rototypeTemplate, attribute{{attribute.name}}Configuration); |
337 {% else %} | 308 {% else %} |
338 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name
}}Configuration = \ | 309 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name
}}Configuration = \ |
339 {{attribute_configuration(attribute)}}; | 310 {{attribute_configuration(attribute)}}; |
340 V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, pr
ototypeTemplate, interfaceTemplate, signature, accessor{{attribute.name}}Configu
ration); | 311 V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, pr
ototypeTemplate, interfaceTemplate, signature, accessor{{attribute.name}}Configu
ration); |
341 {% endif %} | 312 {% endif %} |
342 {% endfor %} | 313 {% endfor %} |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 {{method_implemented_in_private_script(method)}} | 379 {{method_implemented_in_private_script(method)}} |
409 {% endfor %} | 380 {% endfor %} |
410 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 381 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
411 {{attribute_getter_implemented_in_private_script(attribute)}} | 382 {{attribute_getter_implemented_in_private_script(attribute)}} |
412 {% if attribute.has_setter %} | 383 {% if attribute.has_setter %} |
413 {{attribute_setter_implemented_in_private_script(attribute)}} | 384 {{attribute_setter_implemented_in_private_script(attribute)}} |
414 {% endif %} | 385 {% endif %} |
415 {% endfor %} | 386 {% endfor %} |
416 {% block partial_interface %}{% endblock %} | 387 {% block partial_interface %}{% endblock %} |
417 } // namespace blink | 388 } // namespace blink |
OLD | NEW |