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

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

Issue 2260113002: Lazily install origin trial features on V8 objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase after parent CL landed Created 4 years, 2 months 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 389 }
390 390
391 {% endif %}{# not is_array_buffer_or_view #} 391 {% endif %}{# not is_array_buffer_or_view #}
392 {% endblock %} 392 {% endblock %}
393 {##############################################################################} 393 {##############################################################################}
394 {% block origin_trials %} 394 {% block origin_trials %}
395 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 395 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
396 {% from 'constants.cpp.tmpl' import constant_configuration with context %} 396 {% from 'constants.cpp.tmpl' import constant_configuration with context %}
397 {% from 'methods.cpp.tmpl' import method_configuration with context %} 397 {% from 'methods.cpp.tmpl' import method_configuration with context %}
398 {% for origin_trial_feature in origin_trial_features %}{{newline}} 398 {% for origin_trial_feature in origin_trial_features %}{{newline}}
399 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState, v8::Local<v8::Object> instance) 399 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)
400 { 400 {
401 {% if attributes | for_origin_trial_feature(origin_trial_feature.name) or 401 {% if attributes | for_origin_trial_feature(origin_trial_feature.name) or
402 methods | method_for_origin_trial_feature(origin_trial_feature.name, i s_partial) %} 402 methods | method_for_origin_trial_feature(origin_trial_feature.name, i s_partial) %}
403 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTyp eInfo.domTemplate(scriptState->isolate(), scriptState->world()); 403 v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTyp eInfo.domTemplate(isolate, world);
404 v8::Local<v8::Signature> signature = v8::Signature::New(scriptState->isolate (), interfaceTemplate); 404 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe mplate);
405 ALLOW_UNUSED_LOCAL(signature); 405 ALLOW_UNUSED_LOCAL(signature);
406 {% endif %} 406 {% endif %}
407 V8PerContextData* perContextData = V8PerContextData::from(scriptState->conte xt());
408 v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_cla ss}}::wrapperTypeInfo);
409 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8 _class}}::wrapperTypeInfo);
410 ALLOW_UNUSED_LOCAL(interface);
411 {# Origin-Trial-enabled attributes #} 407 {# Origin-Trial-enabled attributes #}
412 {% for attribute in attributes | for_origin_trial_feature(origin_trial_featu re.name) | unique_by('name') | sort %} 408 {% for attribute in attributes | for_origin_trial_feature(origin_trial_featu re.name) | unique_by('name') | sort %}
413 {% if attribute.is_data_type_property %} 409 {% if attribute.is_data_type_property %}
414 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \ 410 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}} Configuration = \
415 {{attribute_configuration(attribute)}}; 411 {{attribute_configuration(attribute)}};
416 V8DOMConfiguration::installAttribute(scriptState->isolate(), scriptState->wo rld(), instance, prototype, attribute{{attribute.name}}Configuration); 412 V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, at tribute{{attribute.name}}Configuration);
417 {% else %} 413 {% else %}
418 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \ 414 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Co nfiguration = \
419 {{attribute_configuration(attribute)}}; 415 {{attribute_configuration(attribute)}};
420 V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->wor ld(), instance, prototype, interface, signature, accessor{{attribute.name}}Confi guration); 416 V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, int erface, signature, accessor{{attribute.name}}Configuration);
421 {% endif %} 417 {% endif %}
422 {% endfor %} 418 {% endfor %}
423 {# Origin-Trial-enabled constants #} 419 {# Origin-Trial-enabled constants #}
424 {% for constant in constants | for_origin_trial_feature(origin_trial_feature .name) | unique_by('name') | sort %} 420 {% for constant in constants | for_origin_trial_feature(origin_trial_feature .name) | unique_by('name') | sort %}
425 {% set constant_name = constant.name.title().replace('_', '') %} 421 {% set constant_name = constant.name.title().replace('_', '') %}
426 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Con figuration = {{constant_configuration(constant)}}; 422 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Con figuration = {{constant_configuration(constant)}};
427 V8DOMConfiguration::installConstant(scriptState->isolate(), interface, proto type, constant{{constant_name}}Configuration); 423 V8DOMConfiguration::installConstant(isolate, interface, prototype, constant{ {constant_name}}Configuration);
428 {% endfor %} 424 {% endfor %}
429 {# Origin-Trial-enabled methods (no overloads) #} 425 {# Origin-Trial-enabled methods (no overloads) #}
430 {% for method in methods | method_for_origin_trial_feature(origin_trial_feat ure.name, is_partial) | unique_by('name') | sort %} 426 {% for method in methods | method_for_origin_trial_feature(origin_trial_feat ure.name, is_partial) | unique_by('name') | sort %}
431 {% set method_name = method.name.title().replace('_', '') %} 427 {% set method_name = method.name.title().replace('_', '') %}
432 const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configura tion = {{method_configuration(method)}}; 428 const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configura tion = {{method_configuration(method)}};
433 V8DOMConfiguration::installMethod(scriptState->isolate(), scriptState->world (), instance, prototype, interface, signature, method{{method_name}}Configuratio n); 429 V8DOMConfiguration::installMethod(isolate, world, instance, prototype, inter face, signature, method{{method_name}}Configuration);
434 {% endfor %} 430 {% endfor %}
435 } 431 }
432
433 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState, v8::Local<v8::Object> instance)
434 {
435 V8PerContextData* perContextData = V8PerContextData::from(scriptState->conte xt());
436 v8::Local<v8::Object> prototype = perContextData->prototypeForType(&{{v8_cla ss}}::wrapperTypeInfo);
437 v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8 _class}}::wrapperTypeInfo);
438 ALLOW_UNUSED_LOCAL(interface);
439 install{{origin_trial_feature.name}}(scriptState->isolate(), scriptState->wo rld(), instance, prototype, interface);
440 }
436 {% if not origin_trial_feature.needs_instance %} 441 {% if not origin_trial_feature.needs_instance %}
437 442
438 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState) 443 void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* scriptState)
439 { 444 {
440 install{{origin_trial_feature.name}}(scriptState, v8::Local<v8::Object>()); 445 install{{origin_trial_feature.name}}(scriptState, v8::Local<v8::Object>());
441 } 446 }
442 {% endif %} 447 {% endif %}
443 {% endfor %} 448 {% endfor %}
444 {% endblock %} 449 {% endblock %}
445 {##############################################################################} 450 {##############################################################################}
(...skipping 11 matching lines...) Expand all
457 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 462 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
458 {{attribute_getter_implemented_in_private_script(attribute)}} 463 {{attribute_getter_implemented_in_private_script(attribute)}}
459 {% if attribute.has_setter %} 464 {% if attribute.has_setter %}
460 {{attribute_setter_implemented_in_private_script(attribute)}} 465 {{attribute_setter_implemented_in_private_script(attribute)}}
461 {% endif %} 466 {% endif %}
462 {% endfor %} 467 {% endfor %}
463 {% block partial_interface %}{% endblock %} 468 {% block partial_interface %}{% endblock %}
464 } // namespace blink 469 } // namespace blink
465 470
466 {% endfilter %}{# format_blink_cpp_source_code #} 471 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698