| Index: third_party/WebKit/Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/UnionTypesCore.cpp b/third_party/WebKit/Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| deleted file mode 100644
|
| index 9401c451b83c610289b08643ef26dea5a72e59d5..0000000000000000000000000000000000000000
|
| --- a/third_party/WebKit/Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| +++ /dev/null
|
| @@ -1,1562 +0,0 @@
|
| -// 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 "bindings/core/v8/UnionTypesCore.h"
|
| -
|
| -#include "bindings/core/v8/Dictionary.h"
|
| -#include "bindings/core/v8/UnionTypesCore.h"
|
| -#include "bindings/core/v8/V8ArrayBuffer.h"
|
| -#include "bindings/core/v8/V8ArrayBufferView.h"
|
| -#include "bindings/core/v8/V8Node.h"
|
| -#include "bindings/core/v8/V8NodeList.h"
|
| -#include "bindings/core/v8/V8TestInterface.h"
|
| -#include "bindings/core/v8/V8TestInterface2.h"
|
| -#include "bindings/core/v8/V8TestInterfaceEmpty.h"
|
| -#include "bindings/core/v8/V8TestInterfaceGarbageCollected.h"
|
| -#include "bindings/core/v8/V8Uint8Array.h"
|
| -#include "bindings/tests/idls/core/TestImplements2.h"
|
| -#include "bindings/tests/idls/core/TestImplements3Implementation.h"
|
| -#include "bindings/tests/idls/core/TestPartialInterface.h"
|
| -#include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h"
|
| -#include "core/dom/FlexibleArrayBufferView.h"
|
| -#include "core/dom/NameNodeList.h"
|
| -#include "core/dom/NodeList.h"
|
| -#include "core/dom/StaticNodeList.h"
|
| -#include "core/html/LabelsNodeList.h"
|
| -
|
| -namespace blink {
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary::ArrayBufferOrArrayBufferViewOrDictionary()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -TestArrayBuffer* ArrayBufferOrArrayBufferViewOrDictionary::getAsArrayBuffer() const
|
| -{
|
| - ASSERT(isArrayBuffer());
|
| - return m_arrayBuffer;
|
| -}
|
| -
|
| -void ArrayBufferOrArrayBufferViewOrDictionary::setArrayBuffer(TestArrayBuffer* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBuffer = value;
|
| - m_type = SpecificTypeArrayBuffer;
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionary::fromArrayBuffer(TestArrayBuffer* value)
|
| -{
|
| - ArrayBufferOrArrayBufferViewOrDictionary container;
|
| - container.setArrayBuffer(value);
|
| - return container;
|
| -}
|
| -
|
| -TestArrayBufferView* ArrayBufferOrArrayBufferViewOrDictionary::getAsArrayBufferView() const
|
| -{
|
| - ASSERT(isArrayBufferView());
|
| - return m_arrayBufferView;
|
| -}
|
| -
|
| -void ArrayBufferOrArrayBufferViewOrDictionary::setArrayBufferView(TestArrayBufferView* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBufferView = value;
|
| - m_type = SpecificTypeArrayBufferView;
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionary::fromArrayBufferView(TestArrayBufferView* value)
|
| -{
|
| - ArrayBufferOrArrayBufferViewOrDictionary container;
|
| - container.setArrayBufferView(value);
|
| - return container;
|
| -}
|
| -
|
| -Dictionary ArrayBufferOrArrayBufferViewOrDictionary::getAsDictionary() const
|
| -{
|
| - ASSERT(isDictionary());
|
| - return m_dictionary;
|
| -}
|
| -
|
| -void ArrayBufferOrArrayBufferViewOrDictionary::setDictionary(Dictionary value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_dictionary = value;
|
| - m_type = SpecificTypeDictionary;
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionary::fromDictionary(Dictionary value)
|
| -{
|
| - ArrayBufferOrArrayBufferViewOrDictionary container;
|
| - container.setDictionary(value);
|
| - return container;
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary::ArrayBufferOrArrayBufferViewOrDictionary(const ArrayBufferOrArrayBufferViewOrDictionary&) = default;
|
| -ArrayBufferOrArrayBufferViewOrDictionary::~ArrayBufferOrArrayBufferViewOrDictionary() = default;
|
| -ArrayBufferOrArrayBufferViewOrDictionary& ArrayBufferOrArrayBufferViewOrDictionary::operator=(const ArrayBufferOrArrayBufferViewOrDictionary&) = default;
|
| -
|
| -DEFINE_TRACE(ArrayBufferOrArrayBufferViewOrDictionary)
|
| -{
|
| - visitor->trace(m_arrayBuffer);
|
| - visitor->trace(m_arrayBufferView);
|
| -}
|
| -
|
| -void V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, ArrayBufferOrArrayBufferViewOrDictionary& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8ArrayBuffer::hasInstance(v8Value, isolate)) {
|
| - TestArrayBuffer* cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBuffer(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8ArrayBufferView::hasInstance(v8Value, isolate)) {
|
| - TestArrayBufferView* cppValue = V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBufferView(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) {
|
| - Dictionary cppValue = Dictionary(v8Value, isolate, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - impl.setDictionary(cppValue);
|
| - return;
|
| - }
|
| -
|
| - exceptionState.throwTypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView or Dictionary)'");
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBuffer:
|
| - return toV8(impl.getAsArrayBuffer(), creationContext, isolate);
|
| - case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBufferView:
|
| - return toV8(impl.getAsArrayBufferView(), creationContext, isolate);
|
| - case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeDictionary:
|
| - return impl.getAsDictionary().v8Value();
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary NativeValueTraits<ArrayBufferOrArrayBufferViewOrDictionary>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - ArrayBufferOrArrayBufferViewOrDictionary impl;
|
| - V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -BooleanOrStringOrUnrestrictedDouble::BooleanOrStringOrUnrestrictedDouble()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -bool BooleanOrStringOrUnrestrictedDouble::getAsBoolean() const
|
| -{
|
| - ASSERT(isBoolean());
|
| - return m_boolean;
|
| -}
|
| -
|
| -void BooleanOrStringOrUnrestrictedDouble::setBoolean(bool value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_boolean = value;
|
| - m_type = SpecificTypeBoolean;
|
| -}
|
| -
|
| -BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromBoolean(bool value)
|
| -{
|
| - BooleanOrStringOrUnrestrictedDouble container;
|
| - container.setBoolean(value);
|
| - return container;
|
| -}
|
| -
|
| -String BooleanOrStringOrUnrestrictedDouble::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void BooleanOrStringOrUnrestrictedDouble::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromString(String value)
|
| -{
|
| - BooleanOrStringOrUnrestrictedDouble container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -double BooleanOrStringOrUnrestrictedDouble::getAsUnrestrictedDouble() const
|
| -{
|
| - ASSERT(isUnrestrictedDouble());
|
| - return m_unrestrictedDouble;
|
| -}
|
| -
|
| -void BooleanOrStringOrUnrestrictedDouble::setUnrestrictedDouble(double value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_unrestrictedDouble = value;
|
| - m_type = SpecificTypeUnrestrictedDouble;
|
| -}
|
| -
|
| -BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromUnrestrictedDouble(double value)
|
| -{
|
| - BooleanOrStringOrUnrestrictedDouble container;
|
| - container.setUnrestrictedDouble(value);
|
| - return container;
|
| -}
|
| -
|
| -BooleanOrStringOrUnrestrictedDouble::BooleanOrStringOrUnrestrictedDouble(const BooleanOrStringOrUnrestrictedDouble&) = default;
|
| -BooleanOrStringOrUnrestrictedDouble::~BooleanOrStringOrUnrestrictedDouble() = default;
|
| -BooleanOrStringOrUnrestrictedDouble& BooleanOrStringOrUnrestrictedDouble::operator=(const BooleanOrStringOrUnrestrictedDouble&) = default;
|
| -
|
| -DEFINE_TRACE(BooleanOrStringOrUnrestrictedDouble)
|
| -{
|
| -}
|
| -
|
| -void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsBoolean()) {
|
| - impl.setBoolean(v8Value.As<v8::Boolean>()->Value());
|
| - return;
|
| - }
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - double cppValue = toDouble(isolate, v8Value, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - impl.setUnrestrictedDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - impl.setString(cppValue);
|
| - return;
|
| - }
|
| -
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case BooleanOrStringOrUnrestrictedDouble::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case BooleanOrStringOrUnrestrictedDouble::SpecificTypeBoolean:
|
| - return v8Boolean(impl.getAsBoolean(), isolate);
|
| - case BooleanOrStringOrUnrestrictedDouble::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - case BooleanOrStringOrUnrestrictedDouble::SpecificTypeUnrestrictedDouble:
|
| - return v8::Number::New(isolate, impl.getAsUnrestrictedDouble());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -BooleanOrStringOrUnrestrictedDouble NativeValueTraits<BooleanOrStringOrUnrestrictedDouble>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - BooleanOrStringOrUnrestrictedDouble impl;
|
| - V8BooleanOrStringOrUnrestrictedDouble::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -DoubleOrString::DoubleOrString()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -double DoubleOrString::getAsDouble() const
|
| -{
|
| - ASSERT(isDouble());
|
| - return m_double;
|
| -}
|
| -
|
| -void DoubleOrString::setDouble(double value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_double = value;
|
| - m_type = SpecificTypeDouble;
|
| -}
|
| -
|
| -DoubleOrString DoubleOrString::fromDouble(double value)
|
| -{
|
| - DoubleOrString container;
|
| - container.setDouble(value);
|
| - return container;
|
| -}
|
| -
|
| -String DoubleOrString::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void DoubleOrString::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -DoubleOrString DoubleOrString::fromString(String value)
|
| -{
|
| - DoubleOrString container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -DoubleOrString::DoubleOrString(const DoubleOrString&) = default;
|
| -DoubleOrString::~DoubleOrString() = default;
|
| -DoubleOrString& DoubleOrString::operator=(const DoubleOrString&) = default;
|
| -
|
| -DEFINE_TRACE(DoubleOrString)
|
| -{
|
| -}
|
| -
|
| -void V8DoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, DoubleOrString& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - double cppValue = toRestrictedDouble(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 DoubleOrString& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case DoubleOrString::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case DoubleOrString::SpecificTypeDouble:
|
| - return v8::Number::New(isolate, impl.getAsDouble());
|
| - case DoubleOrString::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -DoubleOrString NativeValueTraits<DoubleOrString>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - DoubleOrString impl;
|
| - V8DoubleOrString::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -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;
|
| -}
|
| -
|
| -NodeOrNodeList::NodeOrNodeList()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -Node* NodeOrNodeList::getAsNode() const
|
| -{
|
| - ASSERT(isNode());
|
| - return m_node;
|
| -}
|
| -
|
| -void NodeOrNodeList::setNode(Node* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_node = value;
|
| - m_type = SpecificTypeNode;
|
| -}
|
| -
|
| -NodeOrNodeList NodeOrNodeList::fromNode(Node* value)
|
| -{
|
| - NodeOrNodeList container;
|
| - container.setNode(value);
|
| - return container;
|
| -}
|
| -
|
| -NodeList* NodeOrNodeList::getAsNodeList() const
|
| -{
|
| - ASSERT(isNodeList());
|
| - return m_nodeList;
|
| -}
|
| -
|
| -void NodeOrNodeList::setNodeList(NodeList* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_nodeList = value;
|
| - m_type = SpecificTypeNodeList;
|
| -}
|
| -
|
| -NodeOrNodeList NodeOrNodeList::fromNodeList(NodeList* value)
|
| -{
|
| - NodeOrNodeList container;
|
| - container.setNodeList(value);
|
| - return container;
|
| -}
|
| -
|
| -NodeOrNodeList::NodeOrNodeList(const NodeOrNodeList&) = default;
|
| -NodeOrNodeList::~NodeOrNodeList() = default;
|
| -NodeOrNodeList& NodeOrNodeList::operator=(const NodeOrNodeList&) = default;
|
| -
|
| -DEFINE_TRACE(NodeOrNodeList)
|
| -{
|
| - visitor->trace(m_node);
|
| - visitor->trace(m_nodeList);
|
| -}
|
| -
|
| -void V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, NodeOrNodeList& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8Node::hasInstance(v8Value, isolate)) {
|
| - Node* cppValue = V8Node::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setNode(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8NodeList::hasInstance(v8Value, isolate)) {
|
| - NodeList* cppValue = V8NodeList::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setNodeList(cppValue);
|
| - return;
|
| - }
|
| -
|
| - exceptionState.throwTypeError("The provided value is not of type '(Node or NodeList)'");
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const NodeOrNodeList& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case NodeOrNodeList::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case NodeOrNodeList::SpecificTypeNode:
|
| - return toV8(impl.getAsNode(), creationContext, isolate);
|
| - case NodeOrNodeList::SpecificTypeNodeList:
|
| - return toV8(impl.getAsNodeList(), creationContext, isolate);
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -NodeOrNodeList NativeValueTraits<NodeOrNodeList>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - NodeOrNodeList impl;
|
| - V8NodeOrNodeList::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView::StringOrArrayBufferOrArrayBufferView()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -String StringOrArrayBufferOrArrayBufferView::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void StringOrArrayBufferOrArrayBufferView::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromString(String value)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -TestArrayBuffer* StringOrArrayBufferOrArrayBufferView::getAsArrayBuffer() const
|
| -{
|
| - ASSERT(isArrayBuffer());
|
| - return m_arrayBuffer;
|
| -}
|
| -
|
| -void StringOrArrayBufferOrArrayBufferView::setArrayBuffer(TestArrayBuffer* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBuffer = value;
|
| - m_type = SpecificTypeArrayBuffer;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromArrayBuffer(TestArrayBuffer* value)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView container;
|
| - container.setArrayBuffer(value);
|
| - return container;
|
| -}
|
| -
|
| -TestArrayBufferView* StringOrArrayBufferOrArrayBufferView::getAsArrayBufferView() const
|
| -{
|
| - ASSERT(isArrayBufferView());
|
| - return m_arrayBufferView;
|
| -}
|
| -
|
| -void StringOrArrayBufferOrArrayBufferView::setArrayBufferView(TestArrayBufferView* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBufferView = value;
|
| - m_type = SpecificTypeArrayBufferView;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromArrayBufferView(TestArrayBufferView* value)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView container;
|
| - container.setArrayBufferView(value);
|
| - return container;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView::StringOrArrayBufferOrArrayBufferView(const StringOrArrayBufferOrArrayBufferView&) = default;
|
| -StringOrArrayBufferOrArrayBufferView::~StringOrArrayBufferOrArrayBufferView() = default;
|
| -StringOrArrayBufferOrArrayBufferView& StringOrArrayBufferOrArrayBufferView::operator=(const StringOrArrayBufferOrArrayBufferView&) = default;
|
| -
|
| -DEFINE_TRACE(StringOrArrayBufferOrArrayBufferView)
|
| -{
|
| - visitor->trace(m_arrayBuffer);
|
| - visitor->trace(m_arrayBufferView);
|
| -}
|
| -
|
| -void V8StringOrArrayBufferOrArrayBufferView::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrArrayBufferOrArrayBufferView& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8ArrayBuffer::hasInstance(v8Value, isolate)) {
|
| - TestArrayBuffer* cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBuffer(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8ArrayBufferView::hasInstance(v8Value, isolate)) {
|
| - TestArrayBufferView* cppValue = V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBufferView(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - impl.setString(cppValue);
|
| - return;
|
| - }
|
| -
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case StringOrArrayBufferOrArrayBufferView::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case StringOrArrayBufferOrArrayBufferView::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - case StringOrArrayBufferOrArrayBufferView::SpecificTypeArrayBuffer:
|
| - return toV8(impl.getAsArrayBuffer(), creationContext, isolate);
|
| - case StringOrArrayBufferOrArrayBufferView::SpecificTypeArrayBufferView:
|
| - return toV8(impl.getAsArrayBufferView(), creationContext, isolate);
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView NativeValueTraits<StringOrArrayBufferOrArrayBufferView>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView impl;
|
| - V8StringOrArrayBufferOrArrayBufferView::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -StringOrDouble::StringOrDouble()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -String StringOrDouble::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void StringOrDouble::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -StringOrDouble StringOrDouble::fromString(String value)
|
| -{
|
| - StringOrDouble container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -double StringOrDouble::getAsDouble() const
|
| -{
|
| - ASSERT(isDouble());
|
| - return m_double;
|
| -}
|
| -
|
| -void StringOrDouble::setDouble(double value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_double = value;
|
| - m_type = SpecificTypeDouble;
|
| -}
|
| -
|
| -StringOrDouble StringOrDouble::fromDouble(double value)
|
| -{
|
| - StringOrDouble container;
|
| - container.setDouble(value);
|
| - return container;
|
| -}
|
| -
|
| -StringOrDouble::StringOrDouble(const StringOrDouble&) = default;
|
| -StringOrDouble::~StringOrDouble() = default;
|
| -StringOrDouble& StringOrDouble::operator=(const StringOrDouble&) = default;
|
| -
|
| -DEFINE_TRACE(StringOrDouble)
|
| -{
|
| -}
|
| -
|
| -void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrDouble& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - double cppValue = toRestrictedDouble(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 StringOrDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case StringOrDouble::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case StringOrDouble::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - case StringOrDouble::SpecificTypeDouble:
|
| - return v8::Number::New(isolate, impl.getAsDouble());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -StringOrDouble NativeValueTraits<StringOrDouble>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - StringOrDouble impl;
|
| - V8StringOrDouble::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -StringOrStringSequence::StringOrStringSequence()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -String StringOrStringSequence::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void StringOrStringSequence::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -StringOrStringSequence StringOrStringSequence::fromString(String value)
|
| -{
|
| - StringOrStringSequence container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -const Vector<String>& StringOrStringSequence::getAsStringSequence() const
|
| -{
|
| - ASSERT(isStringSequence());
|
| - return m_stringSequence;
|
| -}
|
| -
|
| -void StringOrStringSequence::setStringSequence(const Vector<String>& value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_stringSequence = value;
|
| - m_type = SpecificTypeStringSequence;
|
| -}
|
| -
|
| -StringOrStringSequence StringOrStringSequence::fromStringSequence(const Vector<String>& value)
|
| -{
|
| - StringOrStringSequence container;
|
| - container.setStringSequence(value);
|
| - return container;
|
| -}
|
| -
|
| -StringOrStringSequence::StringOrStringSequence(const StringOrStringSequence&) = default;
|
| -StringOrStringSequence::~StringOrStringSequence() = default;
|
| -StringOrStringSequence& StringOrStringSequence::operator=(const StringOrStringSequence&) = default;
|
| -
|
| -DEFINE_TRACE(StringOrStringSequence)
|
| -{
|
| -}
|
| -
|
| -void V8StringOrStringSequence::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrStringSequence& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsArray()) {
|
| - Vector<String> cppValue = toImplArray<Vector<String>>(v8Value, 0, isolate, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - impl.setStringSequence(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - impl.setString(cppValue);
|
| - return;
|
| - }
|
| -
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const StringOrStringSequence& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case StringOrStringSequence::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case StringOrStringSequence::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - case StringOrStringSequence::SpecificTypeStringSequence:
|
| - return toV8(impl.getAsStringSequence(), creationContext, isolate);
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -StringOrStringSequence NativeValueTraits<StringOrStringSequence>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - StringOrStringSequence impl;
|
| - V8StringOrStringSequence::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestEnumOrDouble::TestEnumOrDouble()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -String TestEnumOrDouble::getAsTestEnum() const
|
| -{
|
| - ASSERT(isTestEnum());
|
| - return m_testEnum;
|
| -}
|
| -
|
| -void TestEnumOrDouble::setTestEnum(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - NonThrowableExceptionState exceptionState;
|
| - const char* validValues[] = {
|
| - "",
|
| - "EnumValue1",
|
| - "EnumValue2",
|
| - "EnumValue3",
|
| - };
|
| - if (!isValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState)) {
|
| - ASSERT_NOT_REACHED();
|
| - return;
|
| - }
|
| - m_testEnum = value;
|
| - m_type = SpecificTypeTestEnum;
|
| -}
|
| -
|
| -TestEnumOrDouble TestEnumOrDouble::fromTestEnum(String value)
|
| -{
|
| - TestEnumOrDouble container;
|
| - container.setTestEnum(value);
|
| - return container;
|
| -}
|
| -
|
| -double TestEnumOrDouble::getAsDouble() const
|
| -{
|
| - ASSERT(isDouble());
|
| - return m_double;
|
| -}
|
| -
|
| -void TestEnumOrDouble::setDouble(double value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_double = value;
|
| - m_type = SpecificTypeDouble;
|
| -}
|
| -
|
| -TestEnumOrDouble TestEnumOrDouble::fromDouble(double value)
|
| -{
|
| - TestEnumOrDouble container;
|
| - container.setDouble(value);
|
| - return container;
|
| -}
|
| -
|
| -TestEnumOrDouble::TestEnumOrDouble(const TestEnumOrDouble&) = default;
|
| -TestEnumOrDouble::~TestEnumOrDouble() = default;
|
| -TestEnumOrDouble& TestEnumOrDouble::operator=(const TestEnumOrDouble&) = default;
|
| -
|
| -DEFINE_TRACE(TestEnumOrDouble)
|
| -{
|
| -}
|
| -
|
| -void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestEnumOrDouble& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - double cppValue = toRestrictedDouble(isolate, v8Value, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - impl.setDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - const char* validValues[] = {
|
| - "",
|
| - "EnumValue1",
|
| - "EnumValue2",
|
| - "EnumValue3",
|
| - };
|
| - if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState))
|
| - return;
|
| - impl.setTestEnum(cppValue);
|
| - return;
|
| - }
|
| -
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case TestEnumOrDouble::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case TestEnumOrDouble::SpecificTypeTestEnum:
|
| - return v8String(isolate, impl.getAsTestEnum());
|
| - case TestEnumOrDouble::SpecificTypeDouble:
|
| - return v8::Number::New(isolate, impl.getAsDouble());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -TestEnumOrDouble NativeValueTraits<TestEnumOrDouble>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - TestEnumOrDouble impl;
|
| - V8TestEnumOrDouble::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array::TestInterface2OrUint8Array()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -TestInterface2* TestInterface2OrUint8Array::getAsTestInterface2() const
|
| -{
|
| - ASSERT(isTestInterface2());
|
| - return m_testInterface2;
|
| -}
|
| -
|
| -void TestInterface2OrUint8Array::setTestInterface2(TestInterface2* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterface2 = value;
|
| - m_type = SpecificTypeTestInterface2;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array TestInterface2OrUint8Array::fromTestInterface2(TestInterface2* value)
|
| -{
|
| - TestInterface2OrUint8Array container;
|
| - container.setTestInterface2(value);
|
| - return container;
|
| -}
|
| -
|
| -DOMUint8Array* TestInterface2OrUint8Array::getAsUint8Array() const
|
| -{
|
| - ASSERT(isUint8Array());
|
| - return m_uint8Array;
|
| -}
|
| -
|
| -void TestInterface2OrUint8Array::setUint8Array(DOMUint8Array* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_uint8Array = value;
|
| - m_type = SpecificTypeUint8Array;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array TestInterface2OrUint8Array::fromUint8Array(DOMUint8Array* value)
|
| -{
|
| - TestInterface2OrUint8Array container;
|
| - container.setUint8Array(value);
|
| - return container;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array::TestInterface2OrUint8Array(const TestInterface2OrUint8Array&) = default;
|
| -TestInterface2OrUint8Array::~TestInterface2OrUint8Array() = default;
|
| -TestInterface2OrUint8Array& TestInterface2OrUint8Array::operator=(const TestInterface2OrUint8Array&) = default;
|
| -
|
| -DEFINE_TRACE(TestInterface2OrUint8Array)
|
| -{
|
| - visitor->trace(m_testInterface2);
|
| - visitor->trace(m_uint8Array);
|
| -}
|
| -
|
| -void V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterface2OrUint8Array& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8TestInterface2::hasInstance(v8Value, isolate)) {
|
| - TestInterface2* cppValue = V8TestInterface2::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterface2(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8Uint8Array::hasInstance(v8Value, isolate)) {
|
| - DOMUint8Array* cppValue = V8Uint8Array::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setUint8Array(cppValue);
|
| - return;
|
| - }
|
| -
|
| - exceptionState.throwTypeError("The provided value is not of type '(TestInterface2 or Uint8Array)'");
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case TestInterface2OrUint8Array::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case TestInterface2OrUint8Array::SpecificTypeTestInterface2:
|
| - return toV8(impl.getAsTestInterface2(), creationContext, isolate);
|
| - case TestInterface2OrUint8Array::SpecificTypeUint8Array:
|
| - return toV8(impl.getAsUint8Array(), creationContext, isolate);
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -TestInterface2OrUint8Array NativeValueTraits<TestInterface2OrUint8Array>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - TestInterface2OrUint8Array impl;
|
| - V8TestInterface2OrUint8Array::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterfaceGarbageCollectedOrString::TestInterfaceGarbageCollectedOrString()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -TestInterfaceGarbageCollected* TestInterfaceGarbageCollectedOrString::getAsTestInterfaceGarbageCollected() const
|
| -{
|
| - ASSERT(isTestInterfaceGarbageCollected());
|
| - return m_testInterfaceGarbageCollected;
|
| -}
|
| -
|
| -void TestInterfaceGarbageCollectedOrString::setTestInterfaceGarbageCollected(TestInterfaceGarbageCollected* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterfaceGarbageCollected = value;
|
| - m_type = SpecificTypeTestInterfaceGarbageCollected;
|
| -}
|
| -
|
| -TestInterfaceGarbageCollectedOrString TestInterfaceGarbageCollectedOrString::fromTestInterfaceGarbageCollected(TestInterfaceGarbageCollected* value)
|
| -{
|
| - TestInterfaceGarbageCollectedOrString container;
|
| - container.setTestInterfaceGarbageCollected(value);
|
| - return container;
|
| -}
|
| -
|
| -String TestInterfaceGarbageCollectedOrString::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void TestInterfaceGarbageCollectedOrString::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -TestInterfaceGarbageCollectedOrString TestInterfaceGarbageCollectedOrString::fromString(String value)
|
| -{
|
| - TestInterfaceGarbageCollectedOrString container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -TestInterfaceGarbageCollectedOrString::TestInterfaceGarbageCollectedOrString(const TestInterfaceGarbageCollectedOrString&) = default;
|
| -TestInterfaceGarbageCollectedOrString::~TestInterfaceGarbageCollectedOrString() = default;
|
| -TestInterfaceGarbageCollectedOrString& TestInterfaceGarbageCollectedOrString::operator=(const TestInterfaceGarbageCollectedOrString&) = default;
|
| -
|
| -DEFINE_TRACE(TestInterfaceGarbageCollectedOrString)
|
| -{
|
| - visitor->trace(m_testInterfaceGarbageCollected);
|
| -}
|
| -
|
| -void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) {
|
| - TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterfaceGarbageCollected(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - impl.setString(cppValue);
|
| - return;
|
| - }
|
| -
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case TestInterfaceGarbageCollectedOrString::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case TestInterfaceGarbageCollectedOrString::SpecificTypeTestInterfaceGarbageCollected:
|
| - return toV8(impl.getAsTestInterfaceGarbageCollected(), creationContext, isolate);
|
| - case TestInterfaceGarbageCollectedOrString::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -TestInterfaceGarbageCollectedOrString NativeValueTraits<TestInterfaceGarbageCollectedOrString>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceGarbageCollectedOrString impl;
|
| - V8TestInterfaceGarbageCollectedOrString::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterfaceOrLong::TestInterfaceOrLong()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -TestInterfaceImplementation* TestInterfaceOrLong::getAsTestInterface() const
|
| -{
|
| - ASSERT(isTestInterface());
|
| - return m_testInterface;
|
| -}
|
| -
|
| -void TestInterfaceOrLong::setTestInterface(TestInterfaceImplementation* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterface = value;
|
| - m_type = SpecificTypeTestInterface;
|
| -}
|
| -
|
| -TestInterfaceOrLong TestInterfaceOrLong::fromTestInterface(TestInterfaceImplementation* value)
|
| -{
|
| - TestInterfaceOrLong container;
|
| - container.setTestInterface(value);
|
| - return container;
|
| -}
|
| -
|
| -int TestInterfaceOrLong::getAsLong() const
|
| -{
|
| - ASSERT(isLong());
|
| - return m_long;
|
| -}
|
| -
|
| -void TestInterfaceOrLong::setLong(int value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_long = value;
|
| - m_type = SpecificTypeLong;
|
| -}
|
| -
|
| -TestInterfaceOrLong TestInterfaceOrLong::fromLong(int value)
|
| -{
|
| - TestInterfaceOrLong container;
|
| - container.setLong(value);
|
| - return container;
|
| -}
|
| -
|
| -TestInterfaceOrLong::TestInterfaceOrLong(const TestInterfaceOrLong&) = default;
|
| -TestInterfaceOrLong::~TestInterfaceOrLong() = default;
|
| -TestInterfaceOrLong& TestInterfaceOrLong::operator=(const TestInterfaceOrLong&) = default;
|
| -
|
| -DEFINE_TRACE(TestInterfaceOrLong)
|
| -{
|
| - visitor->trace(m_testInterface);
|
| -}
|
| -
|
| -void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrLong& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8TestInterface::hasInstance(v8Value, isolate)) {
|
| - TestInterfaceImplementation* cppValue = V8TestInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterface(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 TestInterfaceOrLong& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case TestInterfaceOrLong::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case TestInterfaceOrLong::SpecificTypeTestInterface:
|
| - return toV8(impl.getAsTestInterface(), creationContext, isolate);
|
| - case TestInterfaceOrLong::SpecificTypeLong:
|
| - return v8::Integer::New(isolate, impl.getAsLong());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -TestInterfaceOrLong NativeValueTraits<TestInterfaceOrLong>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceOrLong impl;
|
| - V8TestInterfaceOrLong::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -TestInterfaceImplementation* TestInterfaceOrTestInterfaceEmpty::getAsTestInterface() const
|
| -{
|
| - ASSERT(isTestInterface());
|
| - return m_testInterface;
|
| -}
|
| -
|
| -void TestInterfaceOrTestInterfaceEmpty::setTestInterface(TestInterfaceImplementation* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterface = value;
|
| - m_type = SpecificTypeTestInterface;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInterface(TestInterfaceImplementation* value)
|
| -{
|
| - TestInterfaceOrTestInterfaceEmpty container;
|
| - container.setTestInterface(value);
|
| - return container;
|
| -}
|
| -
|
| -TestInterfaceEmpty* TestInterfaceOrTestInterfaceEmpty::getAsTestInterfaceEmpty() const
|
| -{
|
| - ASSERT(isTestInterfaceEmpty());
|
| - return m_testInterfaceEmpty;
|
| -}
|
| -
|
| -void TestInterfaceOrTestInterfaceEmpty::setTestInterfaceEmpty(TestInterfaceEmpty* value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterfaceEmpty = value;
|
| - m_type = SpecificTypeTestInterfaceEmpty;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInterfaceEmpty(TestInterfaceEmpty* value)
|
| -{
|
| - TestInterfaceOrTestInterfaceEmpty container;
|
| - container.setTestInterfaceEmpty(value);
|
| - return container;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty(const TestInterfaceOrTestInterfaceEmpty&) = default;
|
| -TestInterfaceOrTestInterfaceEmpty::~TestInterfaceOrTestInterfaceEmpty() = default;
|
| -TestInterfaceOrTestInterfaceEmpty& TestInterfaceOrTestInterfaceEmpty::operator=(const TestInterfaceOrTestInterfaceEmpty&) = default;
|
| -
|
| -DEFINE_TRACE(TestInterfaceOrTestInterfaceEmpty)
|
| -{
|
| - visitor->trace(m_testInterface);
|
| - visitor->trace(m_testInterfaceEmpty);
|
| -}
|
| -
|
| -void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (V8TestInterface::hasInstance(v8Value, isolate)) {
|
| - TestInterfaceImplementation* cppValue = V8TestInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterface(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) {
|
| - TestInterfaceEmpty* cppValue = V8TestInterfaceEmpty::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterfaceEmpty(cppValue);
|
| - return;
|
| - }
|
| -
|
| - exceptionState.throwTypeError("The provided value is not of type '(TestInterface or TestInterfaceEmpty)'");
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case TestInterfaceOrTestInterfaceEmpty::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterface:
|
| - return toV8(impl.getAsTestInterface(), creationContext, isolate);
|
| - case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterfaceEmpty:
|
| - return toV8(impl.getAsTestInterfaceEmpty(), creationContext, isolate);
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty NativeValueTraits<TestInterfaceOrTestInterfaceEmpty>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceOrTestInterfaceEmpty impl;
|
| - V8TestInterfaceOrTestInterfaceEmpty::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -UnrestrictedDoubleOrString::UnrestrictedDoubleOrString()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -double UnrestrictedDoubleOrString::getAsUnrestrictedDouble() const
|
| -{
|
| - ASSERT(isUnrestrictedDouble());
|
| - return m_unrestrictedDouble;
|
| -}
|
| -
|
| -void UnrestrictedDoubleOrString::setUnrestrictedDouble(double value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_unrestrictedDouble = value;
|
| - m_type = SpecificTypeUnrestrictedDouble;
|
| -}
|
| -
|
| -UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromUnrestrictedDouble(double value)
|
| -{
|
| - UnrestrictedDoubleOrString container;
|
| - container.setUnrestrictedDouble(value);
|
| - return container;
|
| -}
|
| -
|
| -String UnrestrictedDoubleOrString::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| -}
|
| -
|
| -void UnrestrictedDoubleOrString::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| -}
|
| -
|
| -UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromString(String value)
|
| -{
|
| - UnrestrictedDoubleOrString container;
|
| - container.setString(value);
|
| - return container;
|
| -}
|
| -
|
| -UnrestrictedDoubleOrString::UnrestrictedDoubleOrString(const UnrestrictedDoubleOrString&) = default;
|
| -UnrestrictedDoubleOrString::~UnrestrictedDoubleOrString() = default;
|
| -UnrestrictedDoubleOrString& UnrestrictedDoubleOrString::operator=(const UnrestrictedDoubleOrString&) = default;
|
| -
|
| -DEFINE_TRACE(UnrestrictedDoubleOrString)
|
| -{
|
| -}
|
| -
|
| -void V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, UnrestrictedDoubleOrString& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - double cppValue = toDouble(isolate, v8Value, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - impl.setUnrestrictedDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - impl.setString(cppValue);
|
| - return;
|
| - }
|
| -
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case UnrestrictedDoubleOrString::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case UnrestrictedDoubleOrString::SpecificTypeUnrestrictedDouble:
|
| - return v8::Number::New(isolate, impl.getAsUnrestrictedDouble());
|
| - case UnrestrictedDoubleOrString::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - UnrestrictedDoubleOrString impl;
|
| - V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -} // namespace blink
|
|
|