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

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

Issue 2750003003: bindings: Correctly expand all class/header dependencies in unions. (Closed)
Patch Set: Created 3 years, 9 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/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp b/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e511eaa7cb2b4bcf778313fcc40e3ac36508b0c9
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
@@ -0,0 +1,118 @@
+// 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!
+
+// This file has been generated from the Jinja2 template in
+// third_party/WebKit/Source/bindings/templates/union_container.cpp.tmpl
+
+// clang-format off
+#include "ElementSequenceOrByteStringDoubleOrStringRecord.h"
+
+#include "bindings/core/v8/DoubleOrString.h"
+#include "bindings/core/v8/IDLTypes.h"
+#include "bindings/core/v8/NativeValueTraitsImpl.h"
+#include "bindings/core/v8/ToV8.h"
+#include "bindings/core/v8/V8Element.h"
+#include "core/animation/ElementAnimation.h"
+#include "core/dom/ChildNode.h"
+#include "core/dom/ElementFullscreen.h"
+#include "core/dom/NonDocumentTypeChildNode.h"
+#include "core/dom/ParentNode.h"
+
+namespace blink {
+
+ElementSequenceOrByteStringDoubleOrStringRecord::ElementSequenceOrByteStringDoubleOrStringRecord() : m_type(SpecificTypeNone) {}
+
+const HeapVector<std::pair<String, DoubleOrString>>& ElementSequenceOrByteStringDoubleOrStringRecord::getAsByteStringDoubleOrStringRecord() const {
+ DCHECK(isByteStringDoubleOrStringRecord());
+ return m_byteStringDoubleOrStringRecord;
+}
+
+void ElementSequenceOrByteStringDoubleOrStringRecord::setByteStringDoubleOrStringRecord(const HeapVector<std::pair<String, DoubleOrString>>& value) {
+ DCHECK(isNull());
+ m_byteStringDoubleOrStringRecord = value;
+ m_type = SpecificTypeByteStringDoubleOrStringRecord;
+}
+
+ElementSequenceOrByteStringDoubleOrStringRecord ElementSequenceOrByteStringDoubleOrStringRecord::fromByteStringDoubleOrStringRecord(const HeapVector<std::pair<String, DoubleOrString>>& value) {
+ ElementSequenceOrByteStringDoubleOrStringRecord container;
+ container.setByteStringDoubleOrStringRecord(value);
+ return container;
+}
+
+const HeapVector<Member<Element>>& ElementSequenceOrByteStringDoubleOrStringRecord::getAsElementSequence() const {
+ DCHECK(isElementSequence());
+ return m_elementSequence;
+}
+
+void ElementSequenceOrByteStringDoubleOrStringRecord::setElementSequence(const HeapVector<Member<Element>>& value) {
+ DCHECK(isNull());
+ m_elementSequence = value;
+ m_type = SpecificTypeElementSequence;
+}
+
+ElementSequenceOrByteStringDoubleOrStringRecord ElementSequenceOrByteStringDoubleOrStringRecord::fromElementSequence(const HeapVector<Member<Element>>& value) {
+ ElementSequenceOrByteStringDoubleOrStringRecord container;
+ container.setElementSequence(value);
+ return container;
+}
+
+ElementSequenceOrByteStringDoubleOrStringRecord::ElementSequenceOrByteStringDoubleOrStringRecord(const ElementSequenceOrByteStringDoubleOrStringRecord&) = default;
+ElementSequenceOrByteStringDoubleOrStringRecord::~ElementSequenceOrByteStringDoubleOrStringRecord() = default;
+ElementSequenceOrByteStringDoubleOrStringRecord& ElementSequenceOrByteStringDoubleOrStringRecord::operator=(const ElementSequenceOrByteStringDoubleOrStringRecord&) = default;
+
+DEFINE_TRACE(ElementSequenceOrByteStringDoubleOrStringRecord) {
+ visitor->trace(m_byteStringDoubleOrStringRecord);
+ visitor->trace(m_elementSequence);
+}
+
+void V8ElementSequenceOrByteStringDoubleOrStringRecord::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, ElementSequenceOrByteStringDoubleOrStringRecord& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
+ if (v8Value.IsEmpty())
+ return;
+
+ if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
+ return;
+
+ if (v8Value->IsArray()) {
+ HeapVector<Member<Element>> cppValue = toMemberNativeArray<Element>(v8Value, 0, isolate, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setElementSequence(cppValue);
+ return;
+ }
+
+ if (v8Value->IsObject()) {
+ HeapVector<std::pair<String, DoubleOrString>> cppValue = NativeValueTraits<IDLRecord<IDLByteString, DoubleOrString>>::nativeValue(isolate, v8Value, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setByteStringDoubleOrStringRecord(cppValue);
+ return;
+ }
+
+ exceptionState.throwTypeError("The provided value is not of type '(sequence<Element> or record<ByteString, (double or DOMString)>)'");
+}
+
+v8::Local<v8::Value> ToV8(const ElementSequenceOrByteStringDoubleOrStringRecord& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
+ switch (impl.m_type) {
+ case ElementSequenceOrByteStringDoubleOrStringRecord::SpecificTypeNone:
+ return v8::Null(isolate);
+ case ElementSequenceOrByteStringDoubleOrStringRecord::SpecificTypeByteStringDoubleOrStringRecord:
+ return ToV8(impl.getAsByteStringDoubleOrStringRecord(), creationContext, isolate);
+ case ElementSequenceOrByteStringDoubleOrStringRecord::SpecificTypeElementSequence:
+ return ToV8(impl.getAsElementSequence(), creationContext, isolate);
+ default:
+ NOTREACHED();
+ }
+ return v8::Local<v8::Value>();
+}
+
+ElementSequenceOrByteStringDoubleOrStringRecord NativeValueTraits<ElementSequenceOrByteStringDoubleOrStringRecord>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
+ ElementSequenceOrByteStringDoubleOrStringRecord impl;
+ V8ElementSequenceOrByteStringDoubleOrStringRecord::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
+ return impl;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698