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

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 299203002: Support per-overload [RuntimeEnabled] extended attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 6 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 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 {% if has_custom_legacy_call_as_function %} 981 {% if has_custom_legacy_call_as_function %}
982 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); 982 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom);
983 {% endif %} 983 {% endif %}
984 {% if interface_name == 'HTMLAllCollection' %} 984 {% if interface_name == 'HTMLAllCollection' %}
985 {# Needed for legacy support of document.all #} 985 {# Needed for legacy support of document.all #}
986 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); 986 functionTemplate->InstanceTemplate()->MarkAsUndetectable();
987 {% endif %} 987 {% endif %}
988 {% for method in custom_registration_methods %} 988 {% for method in custom_registration_methods %}
989 {# install_custom_signature #} 989 {# install_custom_signature #}
990 {% filter conditional(method.conditional_string) %} 990 {% filter conditional(method.conditional_string) %}
991 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all if m ethod.overloads else
Nils Barth (inactive) 2014/06/12 11:45:06 Could you wrap this line?
992 method.runtime_enabled_function) %}
991 {% if method.is_do_not_check_security %} 993 {% if method.is_do_not_check_security %}
992 {% if method.is_per_world_bindings %} 994 {% if method.is_per_world_bindings %}
993 if (DOMWrapperWorld::current(isolate).isMainWorld()) { 995 if (DOMWrapperWorld::current(isolate).isMainWorld()) {
994 {{install_do_not_check_security_signature(method, 'ForMainWorld')}} 996 {{install_do_not_check_security_signature(method, 'ForMainWorld')}}
995 } else { 997 } else {
996 {{install_do_not_check_security_signature(method)}} 998 {{install_do_not_check_security_signature(method)}}
997 } 999 }
998 {% else %} 1000 {% else %}
999 {{install_do_not_check_security_signature(method)}} 1001 {{install_do_not_check_security_signature(method)}}
1000 {% endif %} 1002 {% endif %}
1001 {% else %}{# is_do_not_check_security #} 1003 {% else %}{# is_do_not_check_security #}
1002 {% if method.is_per_world_bindings %} 1004 {% if method.is_per_world_bindings %}
1003 if (DOMWrapperWorld::current(isolate).isMainWorld()) { 1005 if (DOMWrapperWorld::current(isolate).isMainWorld()) {
1004 {% filter runtime_enabled(method.runtime_enabled_function) %}
Nils Barth (inactive) 2014/06/12 11:45:06 Thanks, this is a lot nicer.
1005 {{install_custom_signature(method, 'ForMainWorld')}} 1006 {{install_custom_signature(method, 'ForMainWorld')}}
1006 {% endfilter %}
1007 } else { 1007 } else {
1008 {% filter runtime_enabled(method.runtime_enabled_function) %}
1009 {{install_custom_signature(method)}} 1008 {{install_custom_signature(method)}}
1010 {% endfilter %}
1011 } 1009 }
1012 {% else %} 1010 {% else %}
1013 {% filter runtime_enabled(method.runtime_enabled_function) %}
1014 {{install_custom_signature(method)}} 1011 {{install_custom_signature(method)}}
1015 {% endfilter %}
1016 {% endif %} 1012 {% endif %}
1017 {% endif %}{# is_do_not_check_security #} 1013 {% endif %}{# is_do_not_check_security #}
1018 {% endfilter %} 1014 {% endfilter %}{# runtime_enabled() #}
1015 {% endfilter %}{# conditional() #}
1019 {% endfor %} 1016 {% endfor %}
1020 {% for attribute in attributes if attribute.is_static %} 1017 {% for attribute in attributes if attribute.is_static %}
1021 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % 1018 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' %
1022 (cpp_class, attribute.name) %} 1019 (cpp_class, attribute.name) %}
1023 {% filter conditional(attribute.conditional_string) %} 1020 {% filter conditional(attribute.conditional_string) %}
1024 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New (isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 1021 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New (isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1025 {% endfilter %} 1022 {% endfilter %}
1026 {% endfor %} 1023 {% endfor %}
1027 {# Special interfaces #} 1024 {# Special interfaces #}
1028 {% if interface_name == 'Window' %} 1025 {% if interface_name == 'Window' %}
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 {% endif %} 1328 {% endif %}
1332 } 1329 }
1333 1330
1334 template<> 1331 template<>
1335 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1332 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1336 { 1333 {
1337 return toV8(impl, creationContext, isolate); 1334 return toV8(impl, creationContext, isolate);
1338 } 1335 }
1339 1336
1340 {% endblock %} 1337 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698