| Index: third_party/WebKit/Source/bindings/tests/results/core/ByteStringOrNodeList.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/ByteStringOrNodeList.cpp b/third_party/WebKit/Source/bindings/tests/results/core/ByteStringOrNodeList.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7a562f5fc20191952135cd003b7582434cdf8f93
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/ByteStringOrNodeList.cpp
|
| @@ -0,0 +1,111 @@
|
| +// 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 "ByteStringOrNodeList.h"
|
| +
|
| +#include "bindings/core/v8/IDLTypes.h"
|
| +#include "bindings/core/v8/NativeValueTraitsImpl.h"
|
| +#include "bindings/core/v8/ToV8.h"
|
| +#include "bindings/core/v8/V8NodeList.h"
|
| +#include "core/dom/NameNodeList.h"
|
| +#include "core/dom/NodeList.h"
|
| +#include "core/dom/StaticNodeList.h"
|
| +#include "core/html/LabelsNodeList.h"
|
| +
|
| +namespace blink {
|
| +
|
| +ByteStringOrNodeList::ByteStringOrNodeList() : m_type(SpecificTypeNone) {}
|
| +
|
| +String ByteStringOrNodeList::getAsByteString() const {
|
| + DCHECK(isByteString());
|
| + return m_byteString;
|
| +}
|
| +
|
| +void ByteStringOrNodeList::setByteString(String value) {
|
| + DCHECK(isNull());
|
| + m_byteString = value;
|
| + m_type = SpecificTypeByteString;
|
| +}
|
| +
|
| +ByteStringOrNodeList ByteStringOrNodeList::fromByteString(String value) {
|
| + ByteStringOrNodeList container;
|
| + container.setByteString(value);
|
| + return container;
|
| +}
|
| +
|
| +NodeList* ByteStringOrNodeList::getAsNodeList() const {
|
| + DCHECK(isNodeList());
|
| + return m_nodeList;
|
| +}
|
| +
|
| +void ByteStringOrNodeList::setNodeList(NodeList* value) {
|
| + DCHECK(isNull());
|
| + m_nodeList = value;
|
| + m_type = SpecificTypeNodeList;
|
| +}
|
| +
|
| +ByteStringOrNodeList ByteStringOrNodeList::fromNodeList(NodeList* value) {
|
| + ByteStringOrNodeList container;
|
| + container.setNodeList(value);
|
| + return container;
|
| +}
|
| +
|
| +ByteStringOrNodeList::ByteStringOrNodeList(const ByteStringOrNodeList&) = default;
|
| +ByteStringOrNodeList::~ByteStringOrNodeList() = default;
|
| +ByteStringOrNodeList& ByteStringOrNodeList::operator=(const ByteStringOrNodeList&) = default;
|
| +
|
| +DEFINE_TRACE(ByteStringOrNodeList) {
|
| + visitor->trace(m_nodeList);
|
| +}
|
| +
|
| +void V8ByteStringOrNodeList::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, ByteStringOrNodeList& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
|
| + if (v8Value.IsEmpty())
|
| + return;
|
| +
|
| + if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| + return;
|
| +
|
| + if (V8NodeList::hasInstance(v8Value, isolate)) {
|
| + NodeList* cppValue = V8NodeList::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| + impl.setNodeList(cppValue);
|
| + return;
|
| + }
|
| +
|
| + {
|
| + V8StringResource<> cppValue = NativeValueTraits<IDLByteString>::nativeValue(isolate, v8Value, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setByteString(cppValue);
|
| + return;
|
| + }
|
| +}
|
| +
|
| +v8::Local<v8::Value> ToV8(const ByteStringOrNodeList& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
|
| + switch (impl.m_type) {
|
| + case ByteStringOrNodeList::SpecificTypeNone:
|
| + return v8::Null(isolate);
|
| + case ByteStringOrNodeList::SpecificTypeByteString:
|
| + return v8String(isolate, impl.getAsByteString());
|
| + case ByteStringOrNodeList::SpecificTypeNodeList:
|
| + return ToV8(impl.getAsNodeList(), creationContext, isolate);
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| + return v8::Local<v8::Value>();
|
| +}
|
| +
|
| +ByteStringOrNodeList NativeValueTraits<ByteStringOrNodeList>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| + ByteStringOrNodeList impl;
|
| + V8ByteStringOrNodeList::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| + return impl;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|