Chromium Code Reviews| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 {% endif %} | 361 {% endif %} |
| 362 } | 362 } |
| 363 | 363 |
| 364 {% endif %}{# not is_array_buffer_or_view #} | 364 {% endif %}{# not is_array_buffer_or_view #} |
| 365 {% endblock %} | 365 {% endblock %} |
| 366 {##############################################################################} | 366 {##############################################################################} |
| 367 {% block origin_trials %} | 367 {% block origin_trials %} |
| 368 {% from 'attributes.cpp' import attribute_configuration with context %} | 368 {% from 'attributes.cpp' import attribute_configuration with context %} |
| 369 {% from 'constants.cpp' import constant_configuration with context %} | 369 {% from 'constants.cpp' import constant_configuration with context %} |
| 370 {% from 'methods.cpp' import method_configuration with context %} | 370 {% from 'methods.cpp' import method_configuration with context %} |
| 371 {% for origin_trial_feature_name in origin_trial_feature_names %}{{newline}} | 371 {% for origin_trial_feature in origin_trial_features %}{{newline}} |
| 372 void {{v8_class_or_partial}}::install{{origin_trial_feature_name}}(ScriptState* scriptState, v8::Local<v8::Object> instance) | 372 {% if origin_trial_feature.needs_instance %} |
|
Yuki
2016/07/08 13:08:24
I'm uneasy with this pattern. The current pattern
iclelland
2016/07/08 14:20:49
That's a fair criticism; I wasn't completely sure
iclelland
2016/07/08 14:48:25
Done.
| |
| 373 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState, v8::Local<v8::Object> instance) | |
| 373 { | 374 { |
| 374 v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptS tate->isolate()); | 375 v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptS tate->isolate()); |
| 375 | 376 |
| 376 {# Origin-Trial-enabled attributes #} | 377 {% if attributes | for_origin_trial_feature(origin_trial_feature.name) or |
| 377 {% if attributes | for_origin_trial_feature(origin_trial_feature_name) or | 378 methods | method_for_origin_trial_feature(origin_trial_feature.name, i s_partial) %} |
| 378 methods | method_for_origin_trial_feature(origin_trial_feature_name, i s_partial) %} | |
| 379 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(scriptState->isola te()); | 379 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(scriptState->isola te()); |
| 380 v8::Local<v8::FunctionTemplate> interfaceTemplate = perIsolateData->findInte rfaceTemplate(scriptState->world(), &{{v8_class}}::wrapperTypeInfo); | 380 v8::Local<v8::FunctionTemplate> interfaceTemplate = perIsolateData->findInte rfaceTemplate(scriptState->world(), &{{v8_class}}::wrapperTypeInfo); |
| 381 v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate (), interfaceTemplate); | 381 v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate (), interfaceTemplate); |
| 382 ALLOW_UNUSED_LOCAL(signature); | 382 ALLOW_UNUSED_LOCAL(signature); |
| 383 {% endif %} | 383 {% endif %} |
| 384 {% if constants | for_origin_trial_feature(origin_trial_feature_name) or | 384 {% if constants | for_origin_trial_feature(origin_trial_feature.name) or |
| 385 methods | method_for_origin_trial_feature(origin_trial_feature_name, i s_partial) %} | 385 methods | method_for_origin_trial_feature(origin_trial_feature.name, i s_partial) %} |
| 386 V8PerContextData* perContextData = V8PerContextData::from(scriptState->conte xt()); | 386 V8PerContextData* perContextData = V8PerContextData::from(scriptState->conte xt()); |
| 387 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8 _class}}::wrapperTypeInfo); | 387 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8 _class}}::wrapperTypeInfo); |
| 388 {% endif %} | 388 {% endif %} |
| 389 {% for attribute in attributes | for_origin_trial_feature(origin_trial_featu re_name) | unique_by('name') | sort %} | 389 {% else %} |
| 390 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState) | |
| 391 { | |
| 392 {% if attributes | for_origin_trial_feature(origin_trial_feature.name) or | |
| 393 methods | method_for_origin_trial_feature(origin_trial_feature.name, i s_partial) %} | |
| 394 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTyp eInfo.domTemplate(scriptState->isolate(), scriptState->world()); | |
|
Yuki
2016/07/08 13:08:24
Just FYI,
If the interface is already defined, yo
iclelland
2016/07/08 14:20:49
Yes. There are cases where that isn't possible, th
iclelland
2016/07/08 14:48:25
Done.
| |
| 395 v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate (), interfaceTemplate); | |
| 396 ALLOW_UNUSED_LOCAL(signature); | |
| 397 {% endif %} | |
| 398 V8PerContextData* perContextData = V8PerContextData::from(scriptState->conte xt()); | |
| 399 {% if constants | for_origin_trial_feature(origin_trial_feature.name) or | |
| 400 methods | method_for_origin_trial_feature(origin_trial_feature.name, i s_partial) %} | |
| 401 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8 _class}}::wrapperTypeInfo); | |
| 402 {% endif %} | |
| 403 v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_cla ss}}::wrapperTypeInfo); | |
| 404 v8::Local<v8::Object> instance; // unused; all members are OnInterface or On Prototype | |
| 405 {% endif %} | |
| 406 {# Origin-Trial-enabled attributes #} | |
| 407 {% for attribute in attributes | for_origin_trial_feature(origin_trial_featu re.name) | unique_by('name') | sort %} | |
| 390 {% if attribute.is_data_type_property %} | 408 {% if attribute.is_data_type_property %} |
| 391 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \ | 409 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \ |
| 392 {{attribute_configuration(attribute)}}; | 410 {{attribute_configuration(attribute)}}; |
| 393 V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->wo rld(), instance, prototype, attribute{{attribute.name}}Configuration); | 411 V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->wo rld(), instance, prototype, attribute{{attribute.name}}Configuration); |
| 394 {% else %} | 412 {% else %} |
| 395 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \ | 413 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \ |
| 396 {{attribute_configuration(attribute)}}; | 414 {{attribute_configuration(attribute)}}; |
| 397 V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->wor ld(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attri bute.name}}Configuration); | 415 V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->wor ld(), instance, prototype, v8::Local<v8::Function>(), signature, accessor{{attri bute.name}}Configuration); |
| 398 {% endif %} | 416 {% endif %} |
| 399 {% endfor %} | 417 {% endfor %} |
| 400 {# Origin-Trial-enabled constants #} | 418 {# Origin-Trial-enabled constants #} |
| 401 {% for constant in constants | for_origin_trial_feature(origin_trial_feature _name) | unique_by('name') | sort %} | 419 {% for constant in constants | for_origin_trial_feature(origin_trial_feature .name) | unique_by('name') | sort %} |
| 402 {% set constant_name = constant.name.title().replace('_', '') %} | 420 {% set constant_name = constant.name.title().replace('_', '') %} |
| 403 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Con figuration = {{constant_configuration(constant)}}; | 421 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Con figuration = {{constant_configuration(constant)}}; |
| 404 V8DOMConfiguration::installConstant(scriptState->isolate(), interface, proto type, constant{{constant_name}}Configuration); | 422 V8DOMConfiguration::installConstant(scriptState->isolate(), interface, proto type, constant{{constant_name}}Configuration); |
| 405 {% endfor %} | 423 {% endfor %} |
| 406 {# Origin-Trial-enabled methods (no overloads) #} | 424 {# Origin-Trial-enabled methods (no overloads) #} |
| 407 {% for method in methods | method_for_origin_trial_feature(origin_trial_feat ure_name, is_partial) | unique_by('name') | sort %} | 425 {% for method in methods | method_for_origin_trial_feature(origin_trial_feat ure.name, is_partial) | unique_by('name') | sort %} |
| 408 {% set method_name = method.name.title().replace('_', '') %} | 426 {% set method_name = method.name.title().replace('_', '') %} |
| 409 const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configura tion = {{method_configuration(method)}}; | 427 const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configura tion = {{method_configuration(method)}}; |
| 410 V8DOMConfiguration::installMethod(scriptState->isolate(), scriptState->world (), instance, prototype, interface, signature, method{{method_name}}Configuratio n); | 428 V8DOMConfiguration::installMethod(scriptState->isolate(), scriptState->world (), instance, prototype, interface, signature, method{{method_name}}Configuratio n); |
| 411 {% endfor %} | 429 {% endfor %} |
| 412 } | 430 } |
| 413 {% endfor %} | 431 {% endfor %} |
| 414 {% endblock %} | 432 {% endblock %} |
| 415 {##############################################################################} | 433 {##############################################################################} |
| 416 {% block get_dom_template %}{% endblock %} | 434 {% block get_dom_template %}{% endblock %} |
| 417 {% block get_dom_template_for_named_properties_object %}{% endblock %} | 435 {% block get_dom_template_for_named_properties_object %}{% endblock %} |
| 418 {% block has_instance %}{% endblock %} | 436 {% block has_instance %}{% endblock %} |
| 419 {% block to_impl %}{% endblock %} | 437 {% block to_impl %}{% endblock %} |
| 420 {% block to_impl_with_type_check %}{% endblock %} | 438 {% block to_impl_with_type_check %}{% endblock %} |
| 421 {% block install_conditional_attributes %}{% endblock %} | 439 {% block install_conditional_attributes %}{% endblock %} |
| 422 {##############################################################################} | 440 {##############################################################################} |
| 423 {% block prepare_prototype_and_interface_object %}{% endblock %} | 441 {% block prepare_prototype_and_interface_object %}{% endblock %} |
| 424 {##############################################################################} | 442 {##############################################################################} |
| 425 {% block to_active_scriptwrappable %}{% endblock %} | 443 {% block to_active_scriptwrappable %}{% endblock %} |
| 426 {% for method in methods if method.is_implemented_in_private_script and method.v isible %} | 444 {% for method in methods if method.is_implemented_in_private_script and method.v isible %} |
| 427 {{method_implemented_in_private_script(method)}} | 445 {{method_implemented_in_private_script(method)}} |
| 428 {% endfor %} | 446 {% endfor %} |
| 429 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 447 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 430 {{attribute_getter_implemented_in_private_script(attribute)}} | 448 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 431 {% if attribute.has_setter %} | 449 {% if attribute.has_setter %} |
| 432 {{attribute_setter_implemented_in_private_script(attribute)}} | 450 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 433 {% endif %} | 451 {% endif %} |
| 434 {% endfor %} | 452 {% endfor %} |
| 435 {% block partial_interface %}{% endblock %} | 453 {% block partial_interface %}{% endblock %} |
| 436 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |