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

Unified Diff: Source/bindings/tests/results/core/V8TestDictionary.cpp

Issue 759893002: IDL: Auto-generate NativeValueTraits for IDL dictionaries (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/core/V8TestDictionary.cpp
diff --git a/Source/bindings/tests/results/core/V8TestDictionary.cpp b/Source/bindings/tests/results/core/V8TestDictionary.cpp
index 49e542fec43939679b4ac54589a82dbd5130403d..d1c686363dd8049f0717f3b8016217a4efe37429 100644
--- a/Source/bindings/tests/results/core/V8TestDictionary.cpp
+++ b/Source/bindings/tests/results/core/V8TestDictionary.cpp
@@ -11,6 +11,7 @@
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/UnionTypesCore.h"
#include "bindings/core/v8/V8Element.h"
+#include "bindings/core/v8/V8InternalDictionary.h"
#include "bindings/core/v8/V8TestInterface.h"
#include "bindings/core/v8/V8TestInterfaceGarbageCollected.h"
#include "bindings/core/v8/V8TestInterfaceWillBeGarbageCollected.h"
@@ -88,6 +89,15 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Valu
return;
}
+ v8::Local<v8::Value> internalDictionarySequenceMemberValue = v8Object->Get(v8String(isolate, "internalDictionarySequenceMember"));
+ if (!internalDictionarySequenceMemberValue.IsEmpty() && !isUndefinedOrNull(internalDictionarySequenceMemberValue)) {
+ TONATIVE_VOID_EXCEPTIONSTATE(Vector<InternalDictionary>, internalDictionarySequenceMember, toImplArray<InternalDictionary>(internalDictionarySequenceMemberValue, 0, isolate, exceptionState), exceptionState);
+ impl.setInternalDictionarySequenceMember(internalDictionarySequenceMember);
+ } else if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+
v8::Local<v8::Value> longMemberValue = v8Object->Get(v8String(isolate, "longMember"));
if (!longMemberValue.IsEmpty() && !isUndefinedOrNull(longMemberValue)) {
TONATIVE_VOID_EXCEPTIONSTATE(int, longMember, toInt32(longMemberValue, exceptionState), exceptionState);
@@ -215,14 +225,20 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Valu
}
-v8::Handle<v8::Value> toV8(TestDictionary& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+v8::Handle<v8::Value> toV8(const TestDictionary& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
toV8TestDictionary(impl, v8Object, creationContext, isolate);
return v8Object;
}
-void toV8TestDictionary(TestDictionary& impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+template<>
+v8::Handle<v8::Value> toV8NoInline(const TestDictionary* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return toV8(*impl, creationContext, isolate);
+}
+
+void toV8TestDictionary(const TestDictionary& impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
if (impl.hasBooleanMember()) {
dictionary->Set(v8String(isolate, "booleanMember"), v8Boolean(impl.booleanMember(), isolate));
@@ -252,6 +268,10 @@ void toV8TestDictionary(TestDictionary& impl, v8::Handle<v8::Object> dictionary,
dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, String("foo")));
}
+ if (impl.hasInternalDictionarySequenceMember()) {
+ dictionary->Set(v8String(isolate, "internalDictionarySequenceMember"), v8Array(impl.internalDictionarySequenceMember(), creationContext, isolate));
+ }
+
if (impl.hasLongMember()) {
dictionary->Set(v8String(isolate, "longMember"), v8::Integer::New(isolate, impl.longMember()));
} else {
@@ -312,4 +332,11 @@ void toV8TestDictionary(TestDictionary& impl, v8::Handle<v8::Object> dictionary,
}
+TestDictionary NativeValueTraits<TestDictionary>::nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
+{
+ TestDictionary impl;
+ V8TestDictionary::toImpl(isolate, value, impl, exceptionState);
+ return impl;
+}
+
} // namespace blink
« no previous file with comments | « Source/bindings/tests/results/core/V8TestDictionary.h ('k') | Source/bindings/tests/results/core/V8TestDictionaryDerived.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698