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

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

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
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/V8TestInterfaceNamedConstructor.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp b/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp
index 7eb21867bbd4db3550068d473420e0e2b3e221d9..f9a5aee67400043c1c1ae60b4b568b8dd6652d0b 100644
--- a/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp
@@ -8,6 +8,7 @@
#include "V8TestInterfaceNamedConstructor.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/Optional.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8HiddenValue.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
@@ -90,39 +91,47 @@ static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio
return;
}
V8StringResource<> stringArg;
- bool defaultUndefinedOptionalBooleanArg;
- int defaultUndefinedOptionalLongArg;
- V8StringResource<> defaultUndefinedOptionalStringArg;
+ bool optionalBooleanArg = false;
+ bool optionalBooleanArgMissing = false;
+ int optionalLongArg = 0;
+ bool optionalLongArgMissing = false;
+ V8StringResource<> optionalStringArg;
+ bool optionalStringArgMissing = false;
V8StringResource<> defaultNullStringOptionalstringArg;
V8StringResource<> optionalStringArg;
+ bool optionalStringArgMissing = false;
{
v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TOSTRING_VOID_INTERNAL(stringArg, info[0]);
- TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalBooleanArg, info[1]->BooleanValue());
- TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(defaultUndefinedOptionalLongArg, toInt32(info[2], exceptionState), exceptionState);
- TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[3]);
+ if (!info[1]->IsUndefined()) {
+ TONATIVE_VOID_INTERNAL(optionalBooleanArg, info[1]->BooleanValue());
+ } else {
+ optionalBooleanArgMissing = true;
+ }
+ if (!info[2]->IsUndefined()) {
+ TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[2], exceptionState), exceptionState);
+ } else {
+ optionalLongArgMissing = true;
+ }
+ if (!info[3]->IsUndefined()) {
+ TOSTRING_VOID_INTERNAL(optionalStringArg, info[3]);
+ } else {
+ optionalStringArgMissing = true;
+ }
if (!info[4]->IsUndefined()) {
TOSTRING_VOID_INTERNAL(defaultNullStringOptionalstringArg, info[4]);
} else {
defaultNullStringOptionalstringArg = nullptr;
}
- if (UNLIKELY(info.Length() <= 5)) {
- Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
- RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor::createForJSConstructor(document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalstringArg, exceptionState);
- if (exceptionState.hadException()) {
- exceptionState.throwIfNeeded();
- return;
- }
- v8::Handle<v8::Object> wrapper = info.Holder();
- V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstructor>(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
- v8SetReturnValue(info, wrapper);
- return;
+ if (!info[5]->IsUndefined()) {
+ TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]);
+ } else {
+ optionalStringArgMissing = true;
}
- TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]);
}
Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
- RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor::createForJSConstructor(document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalstringArg, optionalStringArg, exceptionState);
+ RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor::createForJSConstructor(document, stringArg, Optional<bool>(optionalBooleanArg, optionalBooleanArgMissing), Optional<int>(optionalLongArg, optionalLongArgMissing), Optional<V8StringResource<> >(optionalStringArg, optionalStringArgMissing), defaultNullStringOptionalstringArg, Optional<V8StringResource<> >(optionalStringArg, optionalStringArgMissing), exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698