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 ...@@ -386,13 +386,17 @@ static void constructor{{constructor.overload_index}}(const v8::FunctionCallback
Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
{% endif %} {% endif %}
{{ref_ptr}}<{{cpp_class}}> impl = {{cpp_class}}::create({{constructor.argument_list | join(', ')}}); {{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 is_constructor_raises_exception %}
if (exceptionState.throwIfNeeded()) if (exceptionState.throwIfNeeded())
return; return;
{% endif %} {% 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}}); V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configuration}});
{% endif %}
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
{% endmacro %} {% endmacro %}
......
...@@ -632,10 +632,10 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -632,10 +632,10 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]);
ExecutionContext* context = currentExecutionContext(info.GetIsolate()); ExecutionContext* context = currentExecutionContext(info.GetIsolate());
RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, exceptionState); RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, exceptionState);
v8::Handle<v8::Object> wrapper = info.Holder();
if (exceptionState.throwIfNeeded()) if (exceptionState.throwIfNeeded())
return; return;
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl.release(), &V8TestInterface::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent); V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl.release(), &V8TestInterface::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
......
...@@ -82,10 +82,10 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -82,10 +82,10 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
ExecutionContext* context = currentExecutionContext(info.GetIsolate()); ExecutionContext* context = currentExecutionContext(info.GetIsolate());
Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, exceptionState); RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, exceptionState);
v8::Handle<v8::Object> wrapper = info.Holder();
if (exceptionState.throwIfNeeded()) if (exceptionState.throwIfNeeded())
return; return;
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
...@@ -114,10 +114,10 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -114,10 +114,10 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
ExecutionContext* context = currentExecutionContext(info.GetIsolate()); ExecutionContext* context = currentExecutionContext(info.GetIsolate());
Document& document = *toDocument(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); 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()) if (exceptionState.throwIfNeeded())
return; return;
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
......
...@@ -79,8 +79,8 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -79,8 +79,8 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
{ {
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg); 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); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
...@@ -99,8 +99,8 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -99,8 +99,8 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
return; return;
} }
RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg); 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); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
......
...@@ -81,8 +81,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -81,8 +81,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg); 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); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl.release(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
......
...@@ -80,9 +80,8 @@ template <typename T> void V8_USE(T) { } ...@@ -80,9 +80,8 @@ template <typename T> void V8_USE(T) { }
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{ {
RefPtr<TestInterfacePython2> impl = TestInterfacePython2::create(); 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); v8SetReturnValue(info, wrapper);
} }
......
...@@ -126,8 +126,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -126,8 +126,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]);
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::create(str); 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); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceWillBeGarbageCollected>(impl.release(), &V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
......
...@@ -159,8 +159,8 @@ static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local ...@@ -159,8 +159,8 @@ static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{ {
RefPtr<TestNode> impl = TestNode::create(); 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); V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl.release(), &V8TestNode::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(info, wrapper); v8SetReturnValue(info, wrapper);
} }
......
...@@ -431,8 +431,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -431,8 +431,8 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]);
RefPtr<TestTypedefs> impl = TestTypedefs::create(hello); 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); V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8TestTypedefs::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper); 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