Chromium Code Reviews| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 functionTemplate->ReadOnlyPrototype(); | 291 functionTemplate->ReadOnlyPrototype(); |
| 292 {% endif %} | 292 {% endif %} |
| 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 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func tionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalF ieldCount, | 307 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 | 308 {# Test needed as size 0 arrays definitions are not allowed per standard |
| 309 (so objects have distinct addresses), which is enforced by MSVC. | 309 (so objects have distinct addresses), which is enforced by MSVC. |
| 310 8.5.1 Aggregates [dcl.init.aggr] | 310 8.5.1 Aggregates [dcl.init.aggr] |
| 311 An array of unknown size initialized with a brace-enclosed | 311 An array of unknown size initialized with a brace-enclosed |
| 312 initializer-list containing n initializer-clauses, where n shall be | 312 initializer-list containing n initializer-clauses, where n shall be |
| 313 greater than zero, is defined as having n elements (8.3.4). #} | 313 greater than zero, is defined as having n elements (8.3.4). #} |
| 314 {% set attributes_name, attributes_length = | 314 {% set attributes_name, attributes_length = |
| 315 ('%sAttributes' % v8_class, | 315 ('%sAttributes' % v8_class, |
| 316 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) | 316 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) |
| 317 if has_attribute_configuration else (0, 0) %} | 317 if has_attribute_configuration else (0, 0) %} |
| 318 {% set accessors_name, accessors_length = | 318 {% set accessors_name, accessors_length = |
| 319 ('%sAccessors' % v8_class, | 319 ('%sAccessors' % v8_class, |
| 320 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) | 320 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) |
| 321 if has_accessor_configuration else (0, 0) %} | 321 if has_accessor_configuration else (0, 0) %} |
| 322 {% set methods_name, methods_length = | 322 {% set methods_name, methods_length = |
| 323 ('%sMethods' % v8_class, | 323 ('%sMethods' % v8_class, |
| 324 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) | 324 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) |
| 325 if method_configuration_methods else (0, 0) %} | 325 if method_configuration_methods else (0, 0) %} |
| 326 {{attributes_name}}, {{attributes_length}}, | 326 {{attributes_name}}, {{attributes_length}}, |
| 327 {{accessors_name}}, {{accessors_length}}, | 327 {{accessors_name}}, {{accessors_length}}, |
| 328 {{methods_name}}, {{methods_length}}); | 328 {{methods_name}}, {{methods_length}}); |
| 329 {% endfilter %} | 329 {% endfilter %}{# runtime_enabled_indent #} |
| 330 | 330 |
| 331 {% if constructors or has_custom_constructor or has_event_constructor %} | 331 {% if constructors or has_custom_constructor or has_event_constructor %} |
| 332 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); | 332 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); |
| 333 functionTemplate->SetLength({{interface_length}}); | 333 functionTemplate->SetLength({{interface_length}}); |
| 334 {% endif %} | 334 {% endif %} |
| 335 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); | 335 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); |
| 336 ALLOW_UNUSED_LOCAL(instanceTemplate); | 336 ALLOW_UNUSED_LOCAL(instanceTemplate); |
| 337 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); | 337 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); |
| 338 ALLOW_UNUSED_LOCAL(prototypeTemplate); | 338 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| 339 {% if custom_registration_methods %} | 339 {% if custom_registration_methods %} |
| 340 ExecutionContext* context = currentExecutionContext(isolate); | 340 ExecutionContext* context = currentExecutionContext(isolate); |
| 341 ALLOW_UNUSED_LOCAL(context); | 341 ALLOW_UNUSED_LOCAL(context); |
| 342 {% endif %} | 342 {% endif %} |
| 343 {% if has_access_check_callbacks %} | 343 {% if has_access_check_callbacks %} |
| 344 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap perTypeInfo))); | 344 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap perTypeInfo))); |
| 345 {% endif %} | 345 {% endif %} |
| 346 {% if has_array_iterator %} | 346 {% if has_array_iterator %} |
| 347 {% filter runtime_enabled('RuntimeEnabledFeatures::iterableCollectionsEnable d') %} | 347 {% filter runtime_enabled('RuntimeEnabledFeatures::iterableCollectionsEnable d()') %} |
| 348 {% if is_global %} | 348 {% if is_global %} |
| 349 instanceTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum); | 349 instanceTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum); |
| 350 {% else %} | 350 {% else %} |
| 351 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate) , v8::kArrayProto_values, v8::DontEnum); | 351 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate) , v8::kArrayProto_values, v8::DontEnum); |
| 352 {% endif %} | 352 {% endif %} |
| 353 {% endfilter %}{# runtime_enabled() #} | 353 {% endfilter %}{# runtime_enabled() #} |
| 354 {% endif %} | 354 {% endif %} |
| 355 {% set runtime_enabled_features = dict() %} | 355 {% set runtime_enabled_features = dict() %} |
| 356 {% for attribute in attributes | 356 {% for attribute in attributes |
| 357 if attribute.runtime_enabled_function and | 357 if attribute.runtime_enabled_function_only and |
| 358 not attribute.exposed_test %} | 358 not attribute.exposed_test %} |
| 359 {% if attribute.runtime_enabled_function not in runtime_enabled_features %} | 359 {% if attribute.runtime_enabled_function_only not in runtime_enabled_fea tures %} |
| 360 {% set unused = runtime_enabled_features.update({attribute.runtime_e nabled_function: []}) %} | 360 {% set unused = runtime_enabled_features.update({attribute.runtime_e nabled_function_only: []}) %} |
| 361 {% endif %} | 361 {% endif %} |
| 362 {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_f unction).append(attribute) %} | 362 {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_f unction_only).append(attribute) %} |
| 363 {% endfor %} | 363 {% endfor %} |
| 364 {% for runtime_enabled_feature in runtime_enabled_features | sort %} | 364 {% for runtime_enabled_feature in runtime_enabled_features | sort %} |
| 365 if ({{runtime_enabled_feature}}()) { | 365 if ({{runtime_enabled_feature}}) { |
| 366 {% set distinct_attributes = [] %} | 366 {% set distinct_attributes = [] %} |
| 367 {% for attribute in runtime_enabled_features.get(runtime_enabled_feature ) | sort | 367 {% for attribute in runtime_enabled_features.get(runtime_enabled_feature ) | sort |
| 368 if attribute.name not in distinct_attributes %} | 368 if attribute.name not in distinct_attributes %} |
| 369 {% set unused = distinct_attributes.append(attribute.name) %} | 369 {% set unused = distinct_attributes.append(attribute.name) %} |
| 370 {% filter conditional(attribute.conditional_string) %} | 370 {% filter conditional(attribute.conditional_string) %} |
| 371 {% filter experimental_framework_runtime_enabled(attribute.api_experimen t_name) %} | |
| 371 {% if attribute.is_data_type_property %} | 372 {% if attribute.is_data_type_property %} |
| 372 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.na me}}Configuration = \ | 373 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.na me}}Configuration = \ |
| 373 {{attribute_configuration(attribute)}}; | 374 {{attribute_configuration(attribute)}}; |
| 374 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototyp eTemplate, attribute{{attribute.name}}Configuration); | 375 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototyp eTemplate, attribute{{attribute.name}}Configuration); |
| 375 {% else %} | 376 {% else %} |
| 376 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name }}Configuration = \ | 377 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name }}Configuration = \ |
| 377 {{attribute_configuration(attribute)}}; | 378 {{attribute_configuration(attribute)}}; |
| 378 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype Template, functionTemplate, defaultSignature, accessor{{attribute.name}}Configur ation); | 379 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype Template, functionTemplate, defaultSignature, accessor{{attribute.name}}Configur ation); |
| 379 {% endif %} | 380 {% endif %} |
| 380 {% endfilter %} | 381 {% endfilter %} |
| 382 {% endfilter %} | |
| 381 {% endfor %} | 383 {% endfor %} |
| 382 } | 384 } |
| 383 {% endfor %} | 385 {% endfor %} |
| 386 {% for attribute in attributes | |
|
Daniel Nishi
2015/12/21 21:20:04
This catches the case of APIExperimentEnabled, but
| |
| 387 if not attribute.runtime_enabled_function_only and | |
| 388 not attribute.exposed_test and | |
| 389 attribute.api_experiment_name %} | |
| 390 {% filter conditional(attribute.conditional_string) %} | |
| 391 {% filter experimental_framework_runtime_enabled(attribute.api_experiment_na me) %} | |
| 392 {% if attribute.is_data_type_property %} | |
| 393 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \ | |
| 394 {{attribute_configuration(attribute)}}; | |
| 395 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototypeTem plate, attribute{{attribute.name}}Configuration); | |
| 396 {% else %} | |
| 397 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \ | |
| 398 {{attribute_configuration(attribute)}}; | |
| 399 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemp late, functionTemplate, defaultSignature, accessor{{attribute.name}}Configuratio n); | |
| 400 {% endif %} | |
| 401 {% endfilter %} | |
| 402 {% endfilter %} | |
| 403 {% endfor %} | |
| 384 {% if constants %} | 404 {% if constants %} |
| 385 {{install_constants() | indent}} | 405 {{install_constants() | indent}} |
| 386 {% endif %} | 406 {% endif %} |
| 387 {# Special operations #} | 407 {# Special operations #} |
| 388 {% if indexed_property_getter %} | 408 {% if indexed_property_getter %} |
| 389 {{install_indexed_property_handler('instanceTemplate') | indent}} | 409 {{install_indexed_property_handler('instanceTemplate') | indent}} |
| 390 {% endif %} | 410 {% endif %} |
| 391 {% if named_property_getter and not has_named_properties_object %} | 411 {% if named_property_getter and not has_named_properties_object %} |
| 392 {{install_named_property_handler('instanceTemplate') | indent}} | 412 {{install_named_property_handler('instanceTemplate') | indent}} |
| 393 {% endif %} | 413 {% endif %} |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 406 {% if interface_name == 'HTMLAllCollection' %} | 426 {% if interface_name == 'HTMLAllCollection' %} |
| 407 {# Needed for legacy support of document.all #} | 427 {# Needed for legacy support of document.all #} |
| 408 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 428 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
| 409 {% endif %} | 429 {% endif %} |
| 410 {% for method in custom_registration_methods %} | 430 {% for method in custom_registration_methods %} |
| 411 {# install_custom_signature #} | 431 {# install_custom_signature #} |
| 412 {% filter conditional(method.conditional_string) %} | 432 {% filter conditional(method.conditional_string) %} |
| 413 {% filter exposed(method.overloads.exposed_test_all | 433 {% filter exposed(method.overloads.exposed_test_all |
| 414 if method.overloads else | 434 if method.overloads else |
| 415 method.exposed_test) %} | 435 method.exposed_test) %} |
| 416 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 436 {% set runtime_enabled_function, api_experiment_name = (method.overloads.run time_enabled_function_all, method.overloads.api_experiment_name_all) if method.o verloads |
| 417 if method.overloads else | 437 else (method.runtime_enabled_function, method.api_experim ent_name) %} |
| 418 method.runtime_enabled_function) %} | 438 {% filter runtime_enabled(runtime_enabled_function) %} |
| 419 {% if method.is_do_not_check_security %} | 439 {% if method.is_do_not_check_security %} |
| 420 {{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prot otypeTemplate') | indent}} | 440 {{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prot otypeTemplate') | indent}} |
| 421 {% else %}{# is_do_not_check_security #} | 441 {% else %}{# is_do_not_check_security #} |
| 422 {% set signature = 'v8::Local<v8::Signature>()' if method.is_do_not_check_si gnature else 'defaultSignature' %} | 442 {% 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}} | 443 {{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate', 'functionTemplate', signature) | indent}} |
| 424 {% endif %}{# is_do_not_check_security #} | 444 {% endif %}{# is_do_not_check_security #} |
| 425 {% endfilter %}{# runtime_enabled() #} | 445 {% endfilter %}{# runtime_enabled() #} |
| 426 {% endfilter %}{# exposed() #} | 446 {% endfilter %}{# exposed() #} |
| 427 {% endfilter %}{# conditional() #} | 447 {% endfilter %}{# conditional() #} |
| 428 {% endfor %} | 448 {% endfor %} |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 458 {% endfor %} | 478 {% endfor %} |
| 459 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 479 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 460 {{attribute_getter_implemented_in_private_script(attribute)}} | 480 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 461 {% if attribute.has_setter %} | 481 {% if attribute.has_setter %} |
| 462 {{attribute_setter_implemented_in_private_script(attribute)}} | 482 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 463 {% endif %} | 483 {% endif %} |
| 464 {% endfor %} | 484 {% endfor %} |
| 465 {% block partial_interface %}{% endblock %} | 485 {% block partial_interface %}{% endblock %} |
| 466 } // namespace blink | 486 } // namespace blink |
| 467 {% endfilter %} | 487 {% endfilter %} |
| OLD | NEW |