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

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

Issue 466323002: IDL: Use Nullable for union type return value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
Index: Source/bindings/tests/results/V8TestTypedefs.cpp
diff --git a/Source/bindings/tests/results/V8TestTypedefs.cpp b/Source/bindings/tests/results/V8TestTypedefs.cpp
index cf9760ae928a5da70fec8f23bcb7983166ad7ac5..57749650212ba9afebab6d56ef79e7bc48b9f4f2 100644
--- a/Source/bindings/tests/results/V8TestTypedefs.cpp
+++ b/Source/bindings/tests/results/V8TestTypedefs.cpp
@@ -196,16 +196,14 @@ static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const
static void testInterfaceOrTestInterfaceEmptyMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
- bool result0Enabled = false;
RefPtr<TestInterfaceImplementation> result0;
- bool result1Enabled = false;
RefPtr<TestInterfaceEmpty> result1;
- impl->testInterfaceOrTestInterfaceEmptyMethod(result0Enabled, result0, result1Enabled, result1);
- if (result0Enabled) {
+ impl->testInterfaceOrTestInterfaceEmptyMethod(result0, result1);
+ if (result0) {
v8SetReturnValue(info, result0.release());
return;
}
- if (result1Enabled) {
+ if (result1) {
v8SetReturnValue(info, result1.release());
return;
}
@@ -219,6 +217,30 @@ static void testInterfaceOrTestInterfaceEmptyMethodMethodCallback(const v8::Func
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
+static void domStringOrDoubleMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
+ String result0;
+ Nullable<double> result1;
+ impl->domStringOrDoubleMethod(result0, result1);
+ if (!result0.isNull()) {
+ v8SetReturnValueString(info, result0, info.GetIsolate());
+ return;
+ }
+ if (result1) {
+ v8SetReturnValue(info, result1.get());
+ return;
+ }
+ v8SetReturnValueNull(info);
+}
+
+static void domStringOrDoubleMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
+ TestTypedefsV8Internal::domStringOrDoubleMethodMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (UNLIKELY(info.Length() < 1)) {
@@ -294,6 +316,7 @@ static const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = {
{"voidMethodTestCallbackInterfaceTypeArg", TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
{"uLongLongMethodTestInterfaceEmptyTypeSequenceArg", TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
{"testInterfaceOrTestInterfaceEmptyMethod", TestTypedefsV8Internal::testInterfaceOrTestInterfaceEmptyMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
+ {"domStringOrDoubleMethod", TestTypedefsV8Internal::domStringOrDoubleMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
{"arrayOfStringsMethodArrayOfStringsArg", TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
{"stringArrayMethodStringArrayArg", TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
};
« no previous file with comments | « Source/bindings/tests/results/V8TestSpecialOperations.cpp ('k') | Source/core/animation/AnimationNodeTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698