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

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

Issue 740453004: IDL: Basic dictionary inheritance support (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
« no previous file with comments | « Source/bindings/tests/results/core/V8TestDictionaryDerived.h ('k') | Source/core/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp
diff --git a/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp b/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ad418437631d4c777e439bee8511ab696db2bac8
--- /dev/null
+++ b/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp
@@ -0,0 +1,75 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
+
+#include "config.h"
+#include "V8TestDictionaryDerivedImplementedAs.h"
+
+#include "bindings/core/v8/Dictionary.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/V8TestDictionary.h"
+
+namespace blink {
+
+void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState& exceptionState)
+{
+ if (isUndefinedOrNull(v8Value))
+ return;
+ if (!v8Value->IsObject()) {
+ exceptionState.throwTypeError("cannot convert to dictionary.");
+ return;
+ }
+
+ V8TestDictionary::toImpl(isolate, v8Value, impl, exceptionState);
+ if (exceptionState.hadException())
+ return;
+
+ // FIXME: Do not use Dictionary and DictionaryHelper
+ // https://crbug.com/321462
+ Dictionary dictionary(v8Value, isolate);
+ // FIXME: Remove this v8::TryCatch once the code is switched from
+ // Dictionary/DictionaryHelper to something that uses ExceptionState.
+ v8::TryCatch block;
+ String derivedStringMember;
+ if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedStringMember", derivedStringMember)) {
+ impl.setDerivedStringMember(derivedStringMember);
+ } else if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+
+ String derivedStringMemberWithDefault;
+ if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedStringMemberWithDefault", derivedStringMemberWithDefault)) {
+ impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault);
+ } else if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
+ }
+
+}
+
+v8::Handle<v8::Value> toV8(TestDictionaryDerivedImplementedAs& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
+ toV8TestDictionary(impl, v8Object, creationContext, isolate);
+ toV8TestDictionaryDerivedImplementedAs(impl, v8Object, creationContext, isolate);
+ return v8Object;
+}
+
+void toV8TestDictionaryDerivedImplementedAs(TestDictionaryDerivedImplementedAs& impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ if (impl.hasDerivedStringMember()) {
+ dictionary->Set(v8String(isolate, "derivedStringMember"), v8String(isolate, impl.derivedStringMember()));
+ }
+
+ if (impl.hasDerivedStringMemberWithDefault()) {
+ dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8String(isolate, impl.derivedStringMemberWithDefault()));
+ } else {
+ dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8String(isolate, String("default string value")));
+ }
+
+}
+
+} // namespace blink
« no previous file with comments | « Source/bindings/tests/results/core/V8TestDictionaryDerived.h ('k') | Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698