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

Unified Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 131973012: Add overload support for non-wrapper type vs. primitive type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline IDB tests Created 6 years, 11 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/tests/results/V8TestInterfaceConstructor2.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index 2f720d8dc49fb97b21151b7ebec0c6375d752da6..360219cd793a36f5a19d35b472b6f9f9c531ef22 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -4726,6 +4726,59 @@ static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
+static void overloadedMethodC1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ if (UNLIKELY(info.Length() < 1)) {
+ throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodC", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
+ return;
+ }
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ V8TRYCATCH_VOID(Dictionary, dictionaryArg, Dictionary(info[0], info.GetIsolate()));
+ if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
+ throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodC", "TestObject", "parameter 1 ('dictionaryArg') is not an object."), info.GetIsolate());
+ return;
+ }
+ imp->overloadedMethodC(dictionaryArg);
+}
+
+static void overloadedMethodC2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ if (UNLIKELY(info.Length() < 1)) {
+ throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodC", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
+ return;
+ }
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ V8TRYCATCH_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()));
+ imp->overloadedMethodC(doubleArg);
+}
+
+static void overloadedMethodCMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ if (((info.Length() == 1) && (info[0]->IsObject()))) {
+ overloadedMethodC1Method(info);
+ return;
+ }
+ if (((info.Length() == 1))) {
+ overloadedMethodC2Method(info);
+ return;
+ }
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedMethodC", "TestObject", info.Holder(), info.GetIsolate());
+ if (UNLIKELY(info.Length() < 1)) {
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+static void overloadedMethodCMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
+ TestObjV8Internal::overloadedMethodCMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+}
+
static void classMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestObj::classMethod();
@@ -5734,6 +5787,7 @@ static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = {
{"overloadedMethod", TestObjV8Internal::overloadedMethodMethodCallback, 0, 1},
{"overloadedMethodA", TestObjV8Internal::overloadedMethodAMethodCallback, 0, 1},
{"overloadedMethodB", TestObjV8Internal::overloadedMethodBMethodCallback, 0, 1},
+ {"overloadedMethodC", TestObjV8Internal::overloadedMethodCMethodCallback, 0, 1},
{"classMethodWithClamp", TestObjV8Internal::classMethodWithClampMethodCallback, 0, 2},
{"methodWithUnsignedLongSequence", TestObjV8Internal::methodWithUnsignedLongSequenceMethodCallback, 0, 1},
{"stringArrayFunction", TestObjV8Internal::stringArrayFunctionMethodCallback, 0, 1},
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698