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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/LongOrTestDictionary.cpp

Issue 1961883002: Generate separate files for union type containers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: third_party/WebKit/Source/bindings/tests/results/core/LongOrTestDictionary.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/LongOrTestDictionary.cpp b/third_party/WebKit/Source/bindings/tests/results/core/LongOrTestDictionary.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..164ef81446da5cacffb963ed917fefe54d503ec7
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/LongOrTestDictionary.cpp
@@ -0,0 +1,126 @@
+// 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 "LongOrTestDictionary.h"
+
+#include "bindings/core/v8/DoubleOrString.h"
+#include "bindings/core/v8/TestInterface2OrUint8Array.h"
+#include "bindings/core/v8/ToV8.h"
+
+namespace blink {
+
+LongOrTestDictionary::LongOrTestDictionary()
+ : m_type(SpecificTypeNone)
+{
+}
+
+int LongOrTestDictionary::getAsLong() const
+{
+ ASSERT(isLong());
+ return m_long;
+}
+
+void LongOrTestDictionary::setLong(int value)
+{
+ ASSERT(isNull());
+ m_long = value;
+ m_type = SpecificTypeLong;
+}
+
+LongOrTestDictionary LongOrTestDictionary::fromLong(int value)
+{
+ LongOrTestDictionary container;
+ container.setLong(value);
+ return container;
+}
+
+TestDictionary LongOrTestDictionary::getAsTestDictionary() const
+{
+ ASSERT(isTestDictionary());
+ return m_testDictionary;
+}
+
+void LongOrTestDictionary::setTestDictionary(TestDictionary value)
+{
+ ASSERT(isNull());
+ m_testDictionary = value;
+ m_type = SpecificTypeTestDictionary;
+}
+
+LongOrTestDictionary LongOrTestDictionary::fromTestDictionary(TestDictionary value)
+{
+ LongOrTestDictionary container;
+ container.setTestDictionary(value);
+ return container;
+}
+
+LongOrTestDictionary::LongOrTestDictionary(const LongOrTestDictionary&) = default;
+LongOrTestDictionary::~LongOrTestDictionary() = default;
+LongOrTestDictionary& LongOrTestDictionary::operator=(const LongOrTestDictionary&) = default;
+
+DEFINE_TRACE(LongOrTestDictionary)
+{
+ visitor->trace(m_testDictionary);
+}
+
+void V8LongOrTestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, LongOrTestDictionary& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
+{
+ if (v8Value.IsEmpty())
+ return;
+
+ if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
+ return;
+
+ if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) {
+ TestDictionary cppValue;
+ V8TestDictionary::toImpl(isolate, v8Value, cppValue, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setTestDictionary(cppValue);
+ return;
+ }
+
+ if (v8Value->IsNumber()) {
+ int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setLong(cppValue);
+ return;
+ }
+
+ {
+ int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setLong(cppValue);
+ return;
+ }
+
+}
+
+v8::Local<v8::Value> toV8(const LongOrTestDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ switch (impl.m_type) {
+ case LongOrTestDictionary::SpecificTypeNone:
+ return v8::Null(isolate);
+ case LongOrTestDictionary::SpecificTypeLong:
+ return v8::Integer::New(isolate, impl.getAsLong());
+ case LongOrTestDictionary::SpecificTypeTestDictionary:
+ return toV8(impl.getAsTestDictionary(), creationContext, isolate);
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return v8::Local<v8::Value>();
+}
+
+LongOrTestDictionary NativeValueTraits<LongOrTestDictionary>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
+{
+ LongOrTestDictionary impl;
+ V8LongOrTestDictionary::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
+ return impl;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698