Commit 1d5cd0f9 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Custom wrap constructor overloads.

Follow up on crrev.com/206793006 and also call wrap() in the code generated
for a particular constructor overloading when [Custom=Wrap] is in effect
for one or more constructors.

R=nbarth@chromium.org,haraken@chromium.org
BUG=338804

Review URL: https://codereview.chromium.org/209893002

git-svn-id: svn://svn.chromium.org/blink/trunk@169839 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d350469c
......@@ -386,13 +386,17 @@ static void constructor{{constructor.overload_index}}(const v8::FunctionCallback
Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
{% endif %}
{{ref_ptr}}<{{cpp_class}}> impl = {{cpp_class}}::create({{constructor.argument_list | join(', ')}});
v8::Handle<v8::Object> wrapper = info.Holder();
{% if is_constructor_raises_exception %}
if (exceptionState.throwIfNeeded())
return;
{% endif %}
{% if has_custom_wrap %}
v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate());
{% else %}
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configuration}});
{% endif %}
v8SetReturnValue(info, wrapper);
}
{% endmacro %}
......
......@@ -632,10 +632,10 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]);
ExecutionContext* context = currentExecutionContext(info.GetIsolate());
RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, exceptionState);
v8::Handle<v8::Object> wrapper = info.Holder();
if (exceptionState.throwIfNeeded())
return;
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl.release(), &V8TestInterface::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(info, wrapper);
}
......
......@@ -82,10 +82,10 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
ExecutionContext* context = currentExecutionContext(info.GetIsolate());
Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, exceptionState);
v8::Handle<v8::Object> wrapper = info.Holder();
if (exceptionState.throwIfNeeded())
return;
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......@@ -114,10 +114,10 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
ExecutionContext* context = currentExecutionContext(info.GetIsolate());
Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionaryArg, sequenceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTestInterfaceEmptyArg, exceptionState);
v8::Handle<v8::Object> wrapper = info.Holder();
if (exceptionState.throwIfNeeded())
return;
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......
......@@ -79,8 +79,8 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg);
v8::Handle<v8::Object> wrapper = info.Holder();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......@@ -99,8 +99,8 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
return;
}
RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg);
v8::Handle<v8::Object> wrapper = info.Holder();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......
......@@ -81,8 +81,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
}
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg);
v8::Handle<v8::Object> wrapper = info.Holder();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl.release(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......
......@@ -80,9 +80,8 @@ template <typename T> void V8_USE(T) { }
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
RefPtr<TestInterfacePython2> impl = TestInterfacePython2::create();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython2>(impl.release(), &V8TestInterfacePython2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate());
v8SetReturnValue(info, wrapper);
}
......
......@@ -126,8 +126,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
}
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]);
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::create(str);
v8::Handle<v8::Object> wrapper = info.Holder();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceWillBeGarbageCollected>(impl.release(), &V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......
......@@ -159,8 +159,8 @@ static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
RefPtr<TestNode> impl = TestNode::create();
v8::Handle<v8::Object> wrapper = info.Holder();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl.release(), &V8TestNode::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(info, wrapper);
}
......
......@@ -431,8 +431,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
}
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]);
RefPtr<TestTypedefs> impl = TestTypedefs::create(hello);
v8::Handle<v8::Object> wrapper = info.Holder();
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8TestTypedefs::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment