| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 {% from 'methods.cpp' import install_custom_signature with context %} | 237 {% from 'methods.cpp' import install_custom_signature with context %} |
| 238 {% from 'attributes.cpp' import attribute_configuration with context %} | 238 {% from 'attributes.cpp' import attribute_configuration with context %} |
| 239 {% from 'constants.cpp' import install_constants with context %} | 239 {% from 'constants.cpp' import install_constants with context %} |
| 240 {% if has_partial_interface or is_partial %} | 240 {% if has_partial_interface or is_partial %} |
| 241 void {{v8_class_or_partial}}::install{{v8_class}}Template(v8::Local<v8::Function
Template> interfaceTemplate, v8::Isolate* isolate) | 241 void {{v8_class_or_partial}}::install{{v8_class}}Template(v8::Local<v8::Function
Template> interfaceTemplate, v8::Isolate* isolate) |
| 242 {% else %} | 242 {% else %} |
| 243 static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> interfac
eTemplate, v8::Isolate* isolate) | 243 static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> interfac
eTemplate, v8::Isolate* isolate) |
| 244 {% endif %} | 244 {% endif %} |
| 245 { | 245 { |
| 246 {% set newline = '' %} | 246 {% set newline = '' %} |
| 247 // Initialize the interface object's template. | |
| 248 {% if is_partial %} | |
| 249 {{v8_class}}::install{{v8_class}}Template(interfaceTemplate, isolate); | |
| 250 {% else %} | |
| 251 {% set parent_interface_template = | 247 {% set parent_interface_template = |
| 252 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class | 248 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class |
| 253 if has_named_properties_object else | 249 if has_named_properties_object else |
| 254 'V8%s::domTemplate(isolate)' % parent_interface | 250 'V8%s::domTemplate(isolate)' % parent_interface |
| 255 if parent_interface else | 251 if parent_interface else |
| 256 'v8::Local<v8::FunctionTemplate>()' %} | 252 'v8::Local<v8::FunctionTemplate>()' %} |
| 257 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplat
e, {{v8_class}}::wrapperTypeInfo.interfaceName, {{parent_interface_template}}, {
{v8_class}}::internalFieldCount); | 253 {% set attribute_conf_array, attribute_conf_count = |
| 258 {% if constructors or has_custom_constructor or has_event_constructor %} | 254 ('%sAttributes' % v8_class, 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_cla
ss) |
| 255 if has_attribute_configuration else ('nullptr', 0) %} |
| 256 {% set accessor_conf_array, accessor_conf_count = |
| 257 ('%sAccessors' % v8_class, 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class
) |
| 258 if has_accessor_configuration else ('nullptr', 0) %} |
| 259 {% set method_conf_array, method_conf_count = |
| 260 ('%sMethods' % v8_class, 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) |
| 261 if method_configuration_methods else ('nullptr', 0) %} |
| 262 // Initialize the interface object's template. |
| 263 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); |
| 264 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); |
| 265 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); |
| 266 {% if is_partial %} |
| 267 {{v8_class}}::install{{v8_class}}Template(interfaceTemplate, isolate); |
| 268 {% if runtime_enabled_function %} |
| 269 if ({{runtime_enabled_function}}()) { |
| 270 {% endif %} |
| 271 {% filter indent(4 if runtime_enabled_function else 0, true) %} |
| 272 V8DOMConfiguration::installProperties(isolate, instanceTemplate, prototypeTe
mplate, interfaceTemplate, signature, {{attribute_conf_array}}, {{attribute_conf
_count}}, {{accessor_conf_array}}, {{accessor_conf_count}}, {{method_conf_array}
}, {{method_conf_count}}); |
| 273 {% if constants %} |
| 274 {{install_constants() | indent}} |
| 275 {% endif %} |
| 276 {% endfilter %}{{newline}} |
| 277 {% if runtime_enabled_function %} |
| 278 } |
| 279 {% endif %} |
| 280 {% elif runtime_enabled_function %}{# if is_partial #} |
| 281 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplat
e, {{v8_class}}::wrapperTypeInfo.interfaceName, {{parent_interface_template}}, i
nstanceTemplate, prototypeTemplate, {{v8_class}}::internalFieldCount); |
| 282 if ({{runtime_enabled_function}}()) { |
| 283 {% if constants %} |
| 284 {{install_constants() | indent}} |
| 285 {% endif %} |
| 286 V8DOMConfiguration::installProperties(isolate, instanceTemplate, prototy
peTemplate, interfaceTemplate, signature, {{attribute_conf_array}}, {{attribute_
conf_count}}, {{accessor_conf_array}}, {{accessor_conf_count}}, {{method_conf_ar
ray}}, {{method_conf_count}}); |
| 287 } |
| 288 {% else %}{# if is_partial #} |
| 289 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplat
e, {{v8_class}}::wrapperTypeInfo.interfaceName, {{parent_interface_template}}, i
nstanceTemplate, prototypeTemplate, {{v8_class}}::internalFieldCount, signature,
{{attribute_conf_array}}, {{attribute_conf_count}}, {{accessor_conf_array}}, {{
accessor_conf_count}}, {{method_conf_array}}, {{method_conf_count}}); |
| 290 {% if constants %} |
| 291 {{install_constants() | indent}} |
| 292 {% endif %} |
| 293 {% endif %}{# is_partial #} |
| 294 |
| 295 {%- if not is_partial and (constructors or has_custom_constructor or has_eve
nt_constructor) %}{{newline}} |
| 259 interfaceTemplate->SetCallHandler({{v8_class}}::constructorCallback); | 296 interfaceTemplate->SetCallHandler({{v8_class}}::constructorCallback); |
| 260 interfaceTemplate->SetLength({{interface_length}}); | 297 interfaceTemplate->SetLength({{interface_length}}); |
| 261 {% endif %} | 298 {% endif %} |
| 262 {% endif %}{# is_partial #} | |
| 263 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); | |
| 264 ALLOW_UNUSED_LOCAL(signature); | |
| 265 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); | |
| 266 ALLOW_UNUSED_LOCAL(instanceTemplate); | |
| 267 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); | |
| 268 ALLOW_UNUSED_LOCAL(prototypeTemplate); | |
| 269 | 299 |
| 270 {%- if not is_partial %} | 300 {%- if not is_partial %} |
| 271 {% if interface_name == 'Window' %}{{newline}} | 301 {% if interface_name == 'Window' %}{{newline}} |
| 272 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 302 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
| 273 {% endif %} | 303 {% endif %} |
| 274 {% if is_global %}{{newline}} | 304 {% if is_global %}{{newline}} |
| 275 interfaceTemplate->SetHiddenPrototype(true); | 305 interfaceTemplate->SetHiddenPrototype(true); |
| 276 {% endif %} | 306 {% endif %} |
| 277 {% endif %} | 307 {% endif %} |
| 278 | 308 |
| 279 // Register DOM constants, attributes and operations. | |
| 280 {% if runtime_enabled_function %} | |
| 281 if ({{runtime_enabled_function}}()) { | |
| 282 {% endif %} | |
| 283 {% filter indent(4 if runtime_enabled_function else 0, true) %} | |
| 284 {% if constants %} | |
| 285 {{install_constants() | indent}} | |
| 286 {% endif %} | |
| 287 {% if has_attribute_configuration %} | |
| 288 V8DOMConfiguration::installAttributes(isolate, instanceTemplate, prototypeTe
mplate, {{'%sAttributes' % v8_class}}, {{'WTF_ARRAY_LENGTH(%sAttributes)' % v8_c
lass}}); | |
| 289 {% endif %} | |
| 290 {% if has_accessor_configuration %} | |
| 291 V8DOMConfiguration::installAccessors(isolate, instanceTemplate, prototypeTem
plate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF_ARRAY_
LENGTH(%sAccessors)' % v8_class}}); | |
| 292 {% endif %} | |
| 293 {% if method_configuration_methods %} | |
| 294 V8DOMConfiguration::installMethods(isolate, instanceTemplate, prototypeTempl
ate, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARRAY_LENG
TH(%sMethods)' % v8_class}}); | |
| 295 {% endif %} | |
| 296 {% endfilter %}{{newline}} | |
| 297 {% if runtime_enabled_function %} | |
| 298 } // if ({{runtime_enabled_function}}()) | |
| 299 {% endif %} | |
| 300 | |
| 301 {%- if has_access_check_callbacks %}{{newline}} | 309 {%- if has_access_check_callbacks %}{{newline}} |
| 302 // Cross-origin access check | 310 // Cross-origin access check |
| 303 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh
eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap
perTypeInfo))); | 311 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh
eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap
perTypeInfo))); |
| 304 {% endif %} | 312 {% endif %} |
| 305 | 313 |
| 306 {%- if has_array_iterator and not is_global %}{{newline}} | 314 {%- if has_array_iterator and not is_global %}{{newline}} |
| 307 // Array iterator | 315 // Array iterator |
| 308 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate)
, v8::kArrayProto_values, v8::DontEnum); | 316 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate)
, v8::kArrayProto_values, v8::DontEnum); |
| 309 {% endif %} | 317 {% endif %} |
| 310 | 318 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 {{method_implemented_in_private_script(method)}} | 411 {{method_implemented_in_private_script(method)}} |
| 404 {% endfor %} | 412 {% endfor %} |
| 405 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 413 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 406 {{attribute_getter_implemented_in_private_script(attribute)}} | 414 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 407 {% if attribute.has_setter %} | 415 {% if attribute.has_setter %} |
| 408 {{attribute_setter_implemented_in_private_script(attribute)}} | 416 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 409 {% endif %} | 417 {% endif %} |
| 410 {% endfor %} | 418 {% endfor %} |
| 411 {% block partial_interface %}{% endblock %} | 419 {% block partial_interface %}{% endblock %} |
| 412 } // namespace blink | 420 } // namespace blink |
| OLD | NEW |