OLD | NEW |
---|---|
1 {% include 'copyright_block.txt' %} | 1 {% include 'copyright_block.txt' %} |
2 #include "config.h" | 2 #include "config.h" |
3 {% filter conditional(conditional_string) %} | 3 {% filter conditional(conditional_string) %} |
4 #include "{{v8_class_or_partial}}.h" | 4 #include "{{v8_class_or_partial}}.h" |
5 | 5 |
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} | 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
7 #include "{{filename}}" | 7 #include "{{filename}}" |
8 {% endfor %} | 8 {% endfor %} |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 | 293 |
294 v8::Local<v8::Signature> defaultSignature; | 294 v8::Local<v8::Signature> defaultSignature; |
295 {% set parent_template = | 295 {% set parent_template = |
296 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class | 296 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class |
297 if has_named_properties_object else | 297 if has_named_properties_object else |
298 'V8%s::domTemplate(isolate)' % parent_interface | 298 'V8%s::domTemplate(isolate)' % parent_interface |
299 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} | 299 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} |
300 {% if runtime_enabled_function %} | 300 {% if runtime_enabled_function %} |
301 if (!{{runtime_enabled_function}}()) | 301 if (!{{runtime_enabled_function}}()) |
302 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::inter nalFieldCount, 0, 0, 0, 0, 0, 0); | 302 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::inter nalFieldCount, 0, 0, 0, 0, 0, 0); |
303 else | 303 else { |
304 {% endif %} | 304 {% endif %} |
305 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} | 305 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} |
306 {% filter indent(runtime_enabled_indent, true) %} | 306 {% filter indent(runtime_enabled_indent, true) %} |
307 {% if api_experiment_name %} | |
308 ExecutionContext* ec = currentExecutionContext(isolate); | |
309 ALLOW_UNUSED_LOCAL(ec); | |
310 if (!Experiments::isApiEnabledWithoutMessage(ec, "{{api_experiment_name}}")) { | |
311 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::inter nalFieldCount, 0, 0, 0, 0, 0, 0); | |
312 } | |
313 else | |
314 {% endif %} | |
315 {% set api_experiment_enabled_indent = 4 if api_experiment_name else runtime _enabled_indent %} | |
316 {% filter indent(api_experiment_enabled_indent, true) %} | |
307 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func tionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalF ieldCount, | 317 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func tionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalF ieldCount, |
308 {# Test needed as size 0 arrays definitions are not allowed per standard | 318 {# Test needed as size 0 arrays definitions are not allowed per standard |
309 (so objects have distinct addresses), which is enforced by MSVC. | 319 (so objects have distinct addresses), which is enforced by MSVC. |
310 8.5.1 Aggregates [dcl.init.aggr] | 320 8.5.1 Aggregates [dcl.init.aggr] |
311 An array of unknown size initialized with a brace-enclosed | 321 An array of unknown size initialized with a brace-enclosed |
312 initializer-list containing n initializer-clauses, where n shall be | 322 initializer-list containing n initializer-clauses, where n shall be |
313 greater than zero, is defined as having n elements (8.3.4). #} | 323 greater than zero, is defined as having n elements (8.3.4). #} |
314 {% set attributes_name, attributes_length = | 324 {% set attributes_name, attributes_length = |
315 ('%sAttributes' % v8_class, | 325 ('%sAttributes' % v8_class, |
316 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) | 326 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) |
317 if has_attribute_configuration else (0, 0) %} | 327 if has_attribute_configuration else (0, 0) %} |
318 {% set accessors_name, accessors_length = | 328 {% set accessors_name, accessors_length = |
319 ('%sAccessors' % v8_class, | 329 ('%sAccessors' % v8_class, |
320 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) | 330 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) |
321 if has_accessor_configuration else (0, 0) %} | 331 if has_accessor_configuration else (0, 0) %} |
322 {% set methods_name, methods_length = | 332 {% set methods_name, methods_length = |
323 ('%sMethods' % v8_class, | 333 ('%sMethods' % v8_class, |
324 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) | 334 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) |
325 if method_configuration_methods else (0, 0) %} | 335 if method_configuration_methods else (0, 0) %} |
326 {{attributes_name}}, {{attributes_length}}, | 336 {{attributes_name}}, {{attributes_length}}, |
327 {{accessors_name}}, {{accessors_length}}, | 337 {{accessors_name}}, {{accessors_length}}, |
328 {{methods_name}}, {{methods_length}}); | 338 {{methods_name}}, {{methods_length}}); |
329 {% endfilter %} | 339 {% endfilter %}{# api_experiment_enabled_indent #} |
340 {% endfilter %}{# runtime_enabled_indent #} | |
341 {% if runtime_enabled_function %} | |
342 | |
343 } | |
344 {% endif %} | |
330 | 345 |
331 {% if constructors or has_custom_constructor or has_event_constructor %} | 346 {% if constructors or has_custom_constructor or has_event_constructor %} |
332 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); | 347 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); |
333 functionTemplate->SetLength({{interface_length}}); | 348 functionTemplate->SetLength({{interface_length}}); |
334 {% endif %} | 349 {% endif %} |
335 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); | 350 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); |
336 ALLOW_UNUSED_LOCAL(instanceTemplate); | 351 ALLOW_UNUSED_LOCAL(instanceTemplate); |
337 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); | 352 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); |
338 ALLOW_UNUSED_LOCAL(prototypeTemplate); | 353 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
339 {% if custom_registration_methods %} | 354 {% if custom_registration_methods %} |
(...skipping 21 matching lines...) Expand all Loading... | |
361 {% endif %} | 376 {% endif %} |
362 {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_f unction).append(attribute) %} | 377 {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_f unction).append(attribute) %} |
363 {% endfor %} | 378 {% endfor %} |
364 {% for runtime_enabled_feature in runtime_enabled_features | sort %} | 379 {% for runtime_enabled_feature in runtime_enabled_features | sort %} |
365 if ({{runtime_enabled_feature}}()) { | 380 if ({{runtime_enabled_feature}}()) { |
366 {% set distinct_attributes = [] %} | 381 {% set distinct_attributes = [] %} |
367 {% for attribute in runtime_enabled_features.get(runtime_enabled_feature ) | sort | 382 {% for attribute in runtime_enabled_features.get(runtime_enabled_feature ) | sort |
368 if attribute.name not in distinct_attributes %} | 383 if attribute.name not in distinct_attributes %} |
369 {% set unused = distinct_attributes.append(attribute.name) %} | 384 {% set unused = distinct_attributes.append(attribute.name) %} |
370 {% filter conditional(attribute.conditional_string) %} | 385 {% filter conditional(attribute.conditional_string) %} |
386 {% filter experimental_framework_runtime_enabled(attribute.api_experimen t_name) %} | |
Daniel Nishi
2015/12/18 01:23:23
If the ExperimentalFramework runtime flag is enabl
| |
371 {% if attribute.is_data_type_property %} | 387 {% if attribute.is_data_type_property %} |
372 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.na me}}Configuration = \ | 388 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.na me}}Configuration = \ |
373 {{attribute_configuration(attribute)}}; | 389 {{attribute_configuration(attribute)}}; |
374 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototyp eTemplate, attribute{{attribute.name}}Configuration); | 390 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototyp eTemplate, attribute{{attribute.name}}Configuration); |
375 {% else %} | 391 {% else %} |
376 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name }}Configuration = \ | 392 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name }}Configuration = \ |
377 {{attribute_configuration(attribute)}}; | 393 {{attribute_configuration(attribute)}}; |
378 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype Template, functionTemplate, defaultSignature, accessor{{attribute.name}}Configur ation); | 394 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype Template, functionTemplate, defaultSignature, accessor{{attribute.name}}Configur ation); |
379 {% endif %} | 395 {% endif %} |
380 {% endfilter %} | 396 {% endfilter %} |
397 {% endfilter %} | |
381 {% endfor %} | 398 {% endfor %} |
382 } | 399 } |
383 {% endfor %} | 400 {% endfor %} |
384 {% if constants %} | 401 {% if constants %} |
385 {{install_constants() | indent}} | 402 {{install_constants() | indent}} |
386 {% endif %} | 403 {% endif %} |
387 {# Special operations #} | 404 {# Special operations #} |
388 {% if indexed_property_getter %} | 405 {% if indexed_property_getter %} |
389 {{install_indexed_property_handler('instanceTemplate') | indent}} | 406 {{install_indexed_property_handler('instanceTemplate') | indent}} |
390 {% endif %} | 407 {% endif %} |
391 {% if named_property_getter and not has_named_properties_object %} | 408 {% if named_property_getter and not has_named_properties_object %} |
392 {{install_named_property_handler('instanceTemplate') | indent}} | 409 {{install_named_property_handler('instanceTemplate') | indent}} |
393 {% endif %} | 410 {% endif %} |
394 {% if iterator_method %} | 411 {% if iterator_method %} |
395 {% filter exposed(iterator_method.exposed_test) %} | 412 {% filter exposed(iterator_method.exposed_test) %} |
396 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %} | 413 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %} |
414 {% filter api_experiment_enabled(iterator_method.api_experiment_name) %} | |
397 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator Configuration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::i teratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScript s, V8DOMConfiguration::OnPrototype }; | 415 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator Configuration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::i teratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScript s, V8DOMConfiguration::OnPrototype }; |
398 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu re, symbolKeyedIteratorConfiguration); | 416 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu re, symbolKeyedIteratorConfiguration); |
417 {% endfilter %}{# api_experiment_enabled() #} | |
399 {% endfilter %}{# runtime_enabled() #} | 418 {% endfilter %}{# runtime_enabled() #} |
400 {% endfilter %}{# exposed() #} | 419 {% endfilter %}{# exposed() #} |
401 {% endif %} | 420 {% endif %} |
402 {# End special operations #} | 421 {# End special operations #} |
403 {% if has_custom_legacy_call_as_function %} | 422 {% if has_custom_legacy_call_as_function %} |
404 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); | 423 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); |
405 {% endif %} | 424 {% endif %} |
406 {% if interface_name == 'HTMLAllCollection' %} | 425 {% if interface_name == 'HTMLAllCollection' %} |
407 {# Needed for legacy support of document.all #} | 426 {# Needed for legacy support of document.all #} |
408 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 427 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
409 {% endif %} | 428 {% endif %} |
410 {% for method in custom_registration_methods %} | 429 {% for method in custom_registration_methods %} |
411 {# install_custom_signature #} | 430 {# install_custom_signature #} |
412 {% filter conditional(method.conditional_string) %} | 431 {% filter conditional(method.conditional_string) %} |
413 {% filter exposed(method.overloads.exposed_test_all | 432 {% filter exposed(method.overloads.exposed_test_all |
414 if method.overloads else | 433 if method.overloads else |
415 method.exposed_test) %} | 434 method.exposed_test) %} |
416 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 435 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
417 if method.overloads else | 436 if method.overloads else |
418 method.runtime_enabled_function) %} | 437 method.runtime_enabled_function) %} |
438 {% filter api_experiment_enabled(method.overloads.api_experiment_name_all | |
439 if method.overloads else | |
440 method.api_experiment_name) %} | |
haraken
2015/12/18 02:35:51
It's not really nice that we have to duplicate cod
Daniel Nishi
2015/12/18 05:11:42
In code_generator_v8, I've shared the implementati
| |
419 {% if method.is_do_not_check_security %} | 441 {% if method.is_do_not_check_security %} |
420 {{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prot otypeTemplate') | indent}} | 442 {{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prot otypeTemplate') | indent}} |
421 {% else %}{# is_do_not_check_security #} | 443 {% else %}{# is_do_not_check_security #} |
422 {% set signature = 'v8::Local<v8::Signature>()' if method.is_do_not_check_si gnature else 'defaultSignature' %} | 444 {% set signature = 'v8::Local<v8::Signature>()' if method.is_do_not_check_si gnature else 'defaultSignature' %} |
423 {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate', 'functionTemplate', signature) | indent}} | 445 {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate', 'functionTemplate', signature) | indent}} |
424 {% endif %}{# is_do_not_check_security #} | 446 {% endif %}{# is_do_not_check_security #} |
447 {% endfilter %}{# api_experiment_enabled() #} | |
425 {% endfilter %}{# runtime_enabled() #} | 448 {% endfilter %}{# runtime_enabled() #} |
426 {% endfilter %}{# exposed() #} | 449 {% endfilter %}{# exposed() #} |
427 {% endfilter %}{# conditional() #} | 450 {% endfilter %}{# conditional() #} |
428 {% endfor %} | 451 {% endfor %} |
429 {# Special interfaces #} | 452 {# Special interfaces #} |
430 {% if not is_partial %} | 453 {% if not is_partial %} |
431 {% if interface_name == 'Window' %} | 454 {% if interface_name == 'Window' %} |
432 | 455 |
433 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 456 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
434 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 457 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
(...skipping 23 matching lines...) Expand all Loading... | |
458 {% endfor %} | 481 {% endfor %} |
459 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 482 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
460 {{attribute_getter_implemented_in_private_script(attribute)}} | 483 {{attribute_getter_implemented_in_private_script(attribute)}} |
461 {% if attribute.has_setter %} | 484 {% if attribute.has_setter %} |
462 {{attribute_setter_implemented_in_private_script(attribute)}} | 485 {{attribute_setter_implemented_in_private_script(attribute)}} |
463 {% endif %} | 486 {% endif %} |
464 {% endfor %} | 487 {% endfor %} |
465 {% block partial_interface %}{% endblock %} | 488 {% block partial_interface %}{% endblock %} |
466 } // namespace blink | 489 } // namespace blink |
467 {% endfilter %} | 490 {% endfilter %} |
OLD | NEW |