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

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

Issue 296403007: Set correct Function.length on overloaded methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix variadics + add tests 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ] %} 44 ] %}
45 {% if not attribute.is_expose_js_accessors %} 45 {% if not attribute.is_expose_js_accessors %}
46 {% set attribute_configuration_list = attribute_configuration_list 46 {% set attribute_configuration_list = attribute_configuration_list
47 + [on_prototype] %} 47 + [on_prototype] %}
48 {% endif %} 48 {% endif %}
49 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 49 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
50 {%- endmacro %} 50 {%- endmacro %}
51 51
52 52
53 {##############################################################################} 53 {##############################################################################}
54 {% from 'methods.cpp' import method_length %}
54 {% macro method_configuration(method) %} 55 {% macro method_configuration(method) %}
55 {% set method_callback = 56 {% set method_callback =
56 '%sV8Internal::%sMethodCallback' % (cpp_class, method.name) %} 57 '%sV8Internal::%sMethodCallback' % (cpp_class, method.name) %}
57 {% set method_callback_for_main_world = 58 {% set method_callback_for_main_world =
58 '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, method.name) 59 '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, method.name)
59 if method.is_per_world_bindings else '0' %} 60 if method.is_per_world_bindings else '0' %}
60 {"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{m ethod.number_of_required_or_variadic_arguments}}} 61 {"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{m ethod_length(method)}}}
61 {%- endmacro %} 62 {%- endmacro %}
62 63
63 64
64 {##############################################################################} 65 {##############################################################################}
65 {% block constructor_getter %} 66 {% block constructor_getter %}
66 {% if has_constructor_attributes %} 67 {% if has_constructor_attributes %}
67 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info) 68 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info)
68 { 69 {
69 v8::Handle<v8::Value> data = info.Data(); 70 v8::Handle<v8::Value> data = info.Data();
70 ASSERT(data->IsExternal()); 71 ASSERT(data->IsExternal());
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 {%- endmacro %} 1072 {%- endmacro %}
1072 1073
1073 1074
1074 {######################################} 1075 {######################################}
1075 {% macro install_custom_signature(method, world_suffix) %} 1076 {% macro install_custom_signature(method, world_suffix) %}
1076 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithCustomSignature #} 1077 {# FIXME: move to V8DOMConfiguration::installDOMCallbacksWithCustomSignature #}
1077 {% set method_callback = '%sV8Internal::%sMethodCallback%s' % 1078 {% set method_callback = '%sV8Internal::%sMethodCallback%s' %
1078 (cpp_class, method.name, world_suffix) %} 1079 (cpp_class, method.name, world_suffix) %}
1079 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % 1080 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' %
1080 ' | '.join(method.property_attributes) %} 1081 ' | '.join(method.property_attributes) %}
1081 {{method.function_template}}->Set(v8AtomicString(isolate, "{{method.name}}"), v8 ::FunctionTemplate::New(isolate, {{method_callback}}, v8Undefined(), {{method.si gnature}}, {{method.number_of_required_or_variadic_arguments}}){% if method.prop erty_attributes %}, {{property_attribute}}{% endif %}); 1082 {{method.function_template}}->Set(v8AtomicString(isolate, "{{method.name}}"), v8 ::FunctionTemplate::New(isolate, {{method_callback}}, v8Undefined(), {{method.si gnature}}, {{method_length(method)}}){% if method.property_attributes %}, {{prop erty_attribute}}{% endif %});
1082 {%- endmacro %} 1083 {%- endmacro %}
1083 1084
1084 1085
1085 {######################################} 1086 {######################################}
1086 {% macro install_constants() %} 1087 {% macro install_constants() %}
1087 {# FIXME: should use reflected_name instead of name #} 1088 {# FIXME: should use reflected_name instead of name #}
1088 {# Normal (always enabled) constants #} 1089 {# Normal (always enabled) constants #}
1089 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = { 1090 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = {
1090 {% for constant in constants if not constant.runtime_enabled_function %} 1091 {% for constant in constants if not constant.runtime_enabled_function %}
1091 {"{{constant.name}}", {{constant.value}}}, 1092 {"{{constant.name}}", {{constant.value}}},
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 {% endif %} 1336 {% endif %}
1336 } 1337 }
1337 1338
1338 template<> 1339 template<>
1339 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1340 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1340 { 1341 {
1341 return toV8(impl, creationContext, isolate); 1342 return toV8(impl, creationContext, isolate);
1342 } 1343 }
1343 1344
1344 {% endblock %} 1345 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698