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

Unified Diff: Source/bindings/templates/methods.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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index f1f0fdb5593b5155d4e13acf141d648f200f3ca3..6b2b9ff4b826ce7e7a6f4a0232ba080da5e38427 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -420,6 +420,16 @@ static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
{##############################################################################}
+{% macro method_length(method) %}
Nils Barth (inactive) 2014/06/04 07:22:02 Could you put this in Python instead, as it's logi
Nils Barth (inactive) 2014/06/04 07:30:50 Also, could you quote the spec? The value of the
Jens Widell 2014/06/04 11:12:54 Done. Although not quite as suggested I think, sin
Nils Barth (inactive) 2014/06/05 00:26:22 =P good point that...
+{% if method.overloads %}
+{{method.overloads.minarg}}
+{%- else %}
+{{method.number_of_required_arguments}}
+{%- endif %}
+{% endmacro %}
+
+
+{##############################################################################}
{% macro origin_safe_method_getter(method, world_suffix) %}
static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::PropertyCallbackInfo<v8::Value>& info)
{
@@ -430,7 +440,7 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
static int domTemplateKey; // This address is used for a key to look up the dom template.
V8PerIsolateData* data = V8PerIsolateData::from(isolate);
{# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #}
- v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_arguments}});
+ v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method_length(method)}});
v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.This(), isolate);
if (holder.IsEmpty()) {
@@ -442,7 +452,7 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
{{cpp_class}}* impl = {{v8_class}}::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), DoNotReportSecurityError)) {
static int sharedTemplateKey; // This address is used for a key to look up the dom template.
- v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sharedTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_arguments}});
+ v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sharedTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method_length(method)}});
v8SetReturnValue(info, sharedTemplate->GetFunction());
return;
}
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698