| Index: third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp b/third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d7cc2ad3d06d7a17ce8439fa87b5f7b5feabb9ad
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp
|
| @@ -0,0 +1,135 @@
|
| +// 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 "DoubleOrStringOrDoubleOrStringSequence.h"
|
| +
|
| +#include "bindings/core/v8/IDLTypes.h"
|
| +#include "bindings/core/v8/NativeValueTraitsImpl.h"
|
| +#include "bindings/core/v8/ToV8.h"
|
| +
|
| +namespace blink {
|
| +
|
| +DoubleOrStringOrDoubleOrStringSequence::DoubleOrStringOrDoubleOrStringSequence() : m_type(SpecificTypeNone) {}
|
| +
|
| +double DoubleOrStringOrDoubleOrStringSequence::getAsDouble() const {
|
| + DCHECK(isDouble());
|
| + return m_double;
|
| +}
|
| +
|
| +void DoubleOrStringOrDoubleOrStringSequence::setDouble(double value) {
|
| + DCHECK(isNull());
|
| + m_double = value;
|
| + m_type = SpecificTypeDouble;
|
| +}
|
| +
|
| +DoubleOrStringOrDoubleOrStringSequence DoubleOrStringOrDoubleOrStringSequence::fromDouble(double value) {
|
| + DoubleOrStringOrDoubleOrStringSequence container;
|
| + container.setDouble(value);
|
| + return container;
|
| +}
|
| +
|
| +const HeapVector<DoubleOrString>& DoubleOrStringOrDoubleOrStringSequence::getAsDoubleOrStringSequence() const {
|
| + DCHECK(isDoubleOrStringSequence());
|
| + return m_doubleOrStringSequence;
|
| +}
|
| +
|
| +void DoubleOrStringOrDoubleOrStringSequence::setDoubleOrStringSequence(const HeapVector<DoubleOrString>& value) {
|
| + DCHECK(isNull());
|
| + m_doubleOrStringSequence = value;
|
| + m_type = SpecificTypeDoubleOrStringSequence;
|
| +}
|
| +
|
| +DoubleOrStringOrDoubleOrStringSequence DoubleOrStringOrDoubleOrStringSequence::fromDoubleOrStringSequence(const HeapVector<DoubleOrString>& value) {
|
| + DoubleOrStringOrDoubleOrStringSequence container;
|
| + container.setDoubleOrStringSequence(value);
|
| + return container;
|
| +}
|
| +
|
| +String DoubleOrStringOrDoubleOrStringSequence::getAsString() const {
|
| + DCHECK(isString());
|
| + return m_string;
|
| +}
|
| +
|
| +void DoubleOrStringOrDoubleOrStringSequence::setString(String value) {
|
| + DCHECK(isNull());
|
| + m_string = value;
|
| + m_type = SpecificTypeString;
|
| +}
|
| +
|
| +DoubleOrStringOrDoubleOrStringSequence DoubleOrStringOrDoubleOrStringSequence::fromString(String value) {
|
| + DoubleOrStringOrDoubleOrStringSequence container;
|
| + container.setString(value);
|
| + return container;
|
| +}
|
| +
|
| +DoubleOrStringOrDoubleOrStringSequence::DoubleOrStringOrDoubleOrStringSequence(const DoubleOrStringOrDoubleOrStringSequence&) = default;
|
| +DoubleOrStringOrDoubleOrStringSequence::~DoubleOrStringOrDoubleOrStringSequence() = default;
|
| +DoubleOrStringOrDoubleOrStringSequence& DoubleOrStringOrDoubleOrStringSequence::operator=(const DoubleOrStringOrDoubleOrStringSequence&) = default;
|
| +
|
| +DEFINE_TRACE(DoubleOrStringOrDoubleOrStringSequence) {
|
| + visitor->trace(m_doubleOrStringSequence);
|
| +}
|
| +
|
| +void V8DoubleOrStringOrDoubleOrStringSequence::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, DoubleOrStringOrDoubleOrStringSequence& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
|
| + if (v8Value.IsEmpty())
|
| + return;
|
| +
|
| + if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| + return;
|
| +
|
| + if (v8Value->IsArray()) {
|
| + HeapVector<DoubleOrString> cppValue = toImplArray<HeapVector<DoubleOrString>>(v8Value, 0, isolate, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setDoubleOrStringSequence(cppValue);
|
| + return;
|
| + }
|
| +
|
| + if (v8Value->IsNumber()) {
|
| + double cppValue = NativeValueTraits<IDLDouble>::nativeValue(isolate, v8Value, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setDouble(cppValue);
|
| + return;
|
| + }
|
| +
|
| + {
|
| + V8StringResource<> cppValue = v8Value;
|
| + if (!cppValue.prepare(exceptionState))
|
| + return;
|
| + impl.setString(cppValue);
|
| + return;
|
| + }
|
| +}
|
| +
|
| +v8::Local<v8::Value> ToV8(const DoubleOrStringOrDoubleOrStringSequence& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
|
| + switch (impl.m_type) {
|
| + case DoubleOrStringOrDoubleOrStringSequence::SpecificTypeNone:
|
| + return v8::Null(isolate);
|
| + case DoubleOrStringOrDoubleOrStringSequence::SpecificTypeDouble:
|
| + return v8::Number::New(isolate, impl.getAsDouble());
|
| + case DoubleOrStringOrDoubleOrStringSequence::SpecificTypeDoubleOrStringSequence:
|
| + return ToV8(impl.getAsDoubleOrStringSequence(), creationContext, isolate);
|
| + case DoubleOrStringOrDoubleOrStringSequence::SpecificTypeString:
|
| + return v8String(isolate, impl.getAsString());
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| + return v8::Local<v8::Value>();
|
| +}
|
| +
|
| +DoubleOrStringOrDoubleOrStringSequence NativeValueTraits<DoubleOrStringOrDoubleOrStringSequence>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| + DoubleOrStringOrDoubleOrStringSequence impl;
|
| + V8DoubleOrStringOrDoubleOrStringSequence::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| + return impl;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|