Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2458183002: Eagerly install Origin Trial features on window (Closed)
Patch Set: Clean up Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 384
385 {% endif %}{# not is_array_buffer_or_view #} 385 {% endif %}{# not is_array_buffer_or_view #}
386 {% endblock %} 386 {% endblock %}
387 {##############################################################################} 387 {##############################################################################}
388 {% block origin_trials %} 388 {% block origin_trials %}
389 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 389 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
390 {% from 'constants.cpp.tmpl' import constant_configuration with context %} 390 {% from 'constants.cpp.tmpl' import constant_configuration with context %}
391 {% from 'methods.cpp.tmpl' import method_configuration with context %} 391 {% from 'methods.cpp.tmpl' import method_configuration with context %}
392 {% for origin_trial_feature in origin_trial_features %}{{newline}} 392 {% for origin_trial_feature in origin_trial_features %}{{newline}}
393 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::Object> instance, v8::Local <v8::Object> prototype, v8::Local<v8::Function> interface) { 393 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(const ScriptS tate* scriptState, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototy pe, v8::Local<v8::Function> interface) {
Yuki 2016/11/01 11:37:54 I have the same thought as I commented at installA
iclelland 2016/11/01 17:06:27 It *is*, though. The method takes |instance|, |pro
394 v8::Isolate* isolate = scriptState->isolate();
395 const DOMWrapperWorld& world = scriptState->world();
394 {% if attributes | for_origin_trial_feature(origin_trial_feature.name) or 396 {% if attributes | for_origin_trial_feature(origin_trial_feature.name) or
395 methods | method_for_origin_trial_feature(origin_trial_feature.name, is_ partial) %} 397 methods | method_for_origin_trial_feature(origin_trial_feature.name, is_ partial) %}
396 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world); 398 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeI nfo.domTemplate(isolate, world);
397 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late); 399 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
398 ALLOW_UNUSED_LOCAL(signature); 400 ALLOW_UNUSED_LOCAL(signature);
399 {% endif %} 401 {% endif %}
400 {# Origin-Trial-enabled attributes #} 402 {# Origin-Trial-enabled attributes #}
401 {% for attribute in attributes | for_origin_trial_feature(origin_trial_feature .name) | unique_by('name') | sort %} 403 {% for attribute in attributes | for_origin_trial_feature(origin_trial_feature .name) | unique_by('name') | sort %}
402 {% if attribute.is_data_type_property %} 404 {% if attribute.is_data_type_property %}
403 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}}; 405 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co nfiguration = {{attribute_configuration(attribute)}};
404 V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attr ibute{{attribute.name}}Configuration); 406 V8DOMConfiguration::installAttribute(scriptState, instance, prototype, attribu te{{attribute.name}}Configuration);
405 {% else %} 407 {% else %}
406 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf iguration = {{attribute_configuration(attribute)}}; 408 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf iguration = {{attribute_configuration(attribute)}};
407 V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, inter face, signature, accessor{{attribute.name}}Configuration); 409 V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, inter face, signature, accessor{{attribute.name}}Configuration);
408 {% endif %} 410 {% endif %}
409 {% endfor %} 411 {% endfor %}
410 {# Origin-Trial-enabled constants #} 412 {# Origin-Trial-enabled constants #}
411 {% for constant in constants | for_origin_trial_feature(origin_trial_feature.n ame) | unique_by('name') | sort %} 413 {% for constant in constants | for_origin_trial_feature(origin_trial_feature.n ame) | unique_by('name') | sort %}
412 {% set constant_name = constant.name.title().replace('_', '') %} 414 {% set constant_name = constant.name.title().replace('_', '') %}
413 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Confi guration = {{constant_configuration(constant)}}; 415 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Confi guration = {{constant_configuration(constant)}};
414 V8DOMConfiguration::installConstant(isolate, interface, prototype, constant{{c onstant_name}}Configuration); 416 V8DOMConfiguration::installConstant(isolate, interface, prototype, constant{{c onstant_name}}Configuration);
415 {% endfor %} 417 {% endfor %}
416 {# Origin-Trial-enabled methods (no overloads) #} 418 {# Origin-Trial-enabled methods (no overloads) #}
417 {% for method in methods | method_for_origin_trial_feature(origin_trial_featur e.name, is_partial) | unique_by('name') | sort %} 419 {% for method in methods | method_for_origin_trial_feature(origin_trial_featur e.name, is_partial) | unique_by('name') | sort %}
418 {% set method_name = method.name.title().replace('_', '') %} 420 {% set method_name = method.name.title().replace('_', '') %}
419 const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configurati on = {{method_configuration(method)}}; 421 const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configurati on = {{method_configuration(method)}};
420 V8DOMConfiguration::installMethod(isolate, world, instance, prototype, interfa ce, signature, method{{method_name}}Configuration); 422 V8DOMConfiguration::installMethod(isolate, world, instance, prototype, interfa ce, signature, method{{method_name}}Configuration);
421 {% endfor %} 423 {% endfor %}
422 } 424 }
423 425
424 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState, v8::Local<v8::Object> instance) { 426 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(const ScriptS tate* scriptState, v8::Local<v8::Object> instance) {
425 V8PerContextData* perContextData = V8PerContextData::from(scriptState->context ()); 427 V8PerContextData* perContextData = V8PerContextData::from(scriptState->context ());
426 v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_class }}::wrapperTypeInfo); 428 v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_class }}::wrapperTypeInfo);
427 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8_c lass}}::wrapperTypeInfo); 429 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8_c lass}}::wrapperTypeInfo);
428 ALLOW_UNUSED_LOCAL(interface); 430 ALLOW_UNUSED_LOCAL(interface);
429 install{{origin_trial_feature.name}}(scriptState->isolate(), scriptState->worl d(), instance, prototype, interface); 431 install{{origin_trial_feature.name}}(scriptState, instance, prototype, interfa ce);
430 } 432 }
431 {% if not origin_trial_feature.needs_instance %} 433 {% if not origin_trial_feature.needs_instance %}
432 434
433 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState) { 435 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(const ScriptS tate* scriptState) {
434 install{{origin_trial_feature.name}}(scriptState, v8::Local<v8::Object>()); 436 install{{origin_trial_feature.name}}(scriptState, v8::Local<v8::Object>());
435 } 437 }
436 {% endif %} 438 {% endif %}
437 {% endfor %} 439 {% endfor %}
438 {% endblock %} 440 {% endblock %}
439 {##############################################################################} 441 {##############################################################################}
440 {% block get_dom_template %}{% endblock %} 442 {% block get_dom_template %}{% endblock %}
441 {% block get_dom_template_for_named_properties_object %}{% endblock %} 443 {% block get_dom_template_for_named_properties_object %}{% endblock %}
442 {% block has_instance %}{% endblock %} 444 {% block has_instance %}{% endblock %}
443 {% block to_impl %}{% endblock %} 445 {% block to_impl %}{% endblock %}
444 {% block to_impl_with_type_check %}{% endblock %} 446 {% block to_impl_with_type_check %}{% endblock %}
445 {##############################################################################} 447 {##############################################################################}
446 {% block prepare_prototype_and_interface_object %}{% endblock %} 448 {% block prepare_prototype_and_interface_object %}{% endblock %}
447 {##############################################################################} 449 {##############################################################################}
448 {% for method in methods if method.is_implemented_in_private_script and method.v isible %} 450 {% for method in methods if method.is_implemented_in_private_script and method.v isible %}
449 {{method_implemented_in_private_script(method)}} 451 {{method_implemented_in_private_script(method)}}
450 {% endfor %} 452 {% endfor %}
451 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 453 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
452 {{attribute_getter_implemented_in_private_script(attribute)}} 454 {{attribute_getter_implemented_in_private_script(attribute)}}
453 {% if attribute.has_setter %} 455 {% if attribute.has_setter %}
454 {{attribute_setter_implemented_in_private_script(attribute)}} 456 {{attribute_setter_implemented_in_private_script(attribute)}}
455 {% endif %} 457 {% endif %}
456 {% endfor %} 458 {% endfor %}
457 {% block partial_interface %}{% endblock %} 459 {% block partial_interface %}{% endblock %}
458 } // namespace blink 460 } // namespace blink
459 461
460 {% endfilter %}{# format_blink_cpp_source_code #} 462 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698