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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.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/BooleanOrElementSequence.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp b/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c94eb1a1b65b5c8bd56a4781f057ede65a3c0ab0
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp
@@ -0,0 +1,116 @@
+// 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 "BooleanOrElementSequence.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 {
+
+BooleanOrElementSequence::BooleanOrElementSequence() : m_type(SpecificTypeNone) {}
+
+bool BooleanOrElementSequence::getAsBoolean() const {
+ DCHECK(isBoolean());
+ return m_boolean;
+}
+
+void BooleanOrElementSequence::setBoolean(bool value) {
+ DCHECK(isNull());
+ m_boolean = value;
+ m_type = SpecificTypeBoolean;
+}
+
+BooleanOrElementSequence BooleanOrElementSequence::fromBoolean(bool value) {
+ BooleanOrElementSequence container;
+ container.setBoolean(value);
+ return container;
+}
+
+const HeapVector<Member<Element>>& BooleanOrElementSequence::getAsElementSequence() const {
+ DCHECK(isElementSequence());
+ return m_elementSequence;
+}
+
+void BooleanOrElementSequence::setElementSequence(const HeapVector<Member<Element>>& value) {
+ DCHECK(isNull());
+ m_elementSequence = value;
+ m_type = SpecificTypeElementSequence;
+}
+
+BooleanOrElementSequence BooleanOrElementSequence::fromElementSequence(const HeapVector<Member<Element>>& value) {
+ BooleanOrElementSequence container;
+ container.setElementSequence(value);
+ return container;
+}
+
+BooleanOrElementSequence::BooleanOrElementSequence(const BooleanOrElementSequence&) = default;
+BooleanOrElementSequence::~BooleanOrElementSequence() = default;
+BooleanOrElementSequence& BooleanOrElementSequence::operator=(const BooleanOrElementSequence&) = default;
+
+DEFINE_TRACE(BooleanOrElementSequence) {
+ visitor->trace(m_elementSequence);
+}
+
+void V8BooleanOrElementSequence::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, BooleanOrElementSequence& 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->IsBoolean()) {
+ impl.setBoolean(v8Value.As<v8::Boolean>()->Value());
+ return;
+ }
+
+ {
+ impl.setBoolean(v8Value->BooleanValue());
+ return;
+ }
+}
+
+v8::Local<v8::Value> ToV8(const BooleanOrElementSequence& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
+ switch (impl.m_type) {
+ case BooleanOrElementSequence::SpecificTypeNone:
+ return v8::Null(isolate);
+ case BooleanOrElementSequence::SpecificTypeBoolean:
+ return v8Boolean(impl.getAsBoolean(), isolate);
+ case BooleanOrElementSequence::SpecificTypeElementSequence:
+ return ToV8(impl.getAsElementSequence(), creationContext, isolate);
+ default:
+ NOTREACHED();
+ }
+ return v8::Local<v8::Value>();
+}
+
+BooleanOrElementSequence NativeValueTraits<BooleanOrElementSequence>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
+ BooleanOrElementSequence impl;
+ V8BooleanOrElementSequence::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
+ return impl;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698