| Index: Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| diff --git a/Source/bindings/tests/results/core/UnionTypesCore.cpp b/Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| index b92097fcffb6b640047f4a1d1ec8c785ae6d95c1..bcc45c3169a5f8174b96f73a1c30b4fa9c0dc4c0 100644
|
| --- a/Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| +++ b/Source/bindings/tests/results/core/UnionTypesCore.cpp
|
| @@ -1,1360 +1,20 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 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 "config.h"
|
| -#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/V8TestDictionary.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/V8TestInterfaceWillBeGarbageCollected.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/NameNodeList.h"
|
| -#include "core/dom/NodeList.h"
|
| -#include "core/dom/StaticNodeList.h"
|
| -#include "core/html/LabelsNodeList.h"
|
| -
|
| -namespace blink {
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary::ArrayBufferOrArrayBufferViewOrDictionary()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -PassRefPtr<TestArrayBuffer> ArrayBufferOrArrayBufferViewOrDictionary::getAsArrayBuffer() const
|
| -{
|
| - ASSERT(isArrayBuffer());
|
| - return m_arrayBuffer;
|
| -}
|
| -
|
| -void ArrayBufferOrArrayBufferViewOrDictionary::setArrayBuffer(PassRefPtr<TestArrayBuffer> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBuffer = value;
|
| - m_type = SpecificTypeArrayBuffer;
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionary::fromArrayBuffer(PassRefPtr<TestArrayBuffer> value)
|
| -{
|
| - ArrayBufferOrArrayBufferViewOrDictionary container;
|
| - container.setArrayBuffer(value);
|
| - return container;
|
| -}
|
| -
|
| -PassRefPtr<TestArrayBufferView> ArrayBufferOrArrayBufferViewOrDictionary::getAsArrayBufferView() const
|
| -{
|
| - ASSERT(isArrayBufferView());
|
| - return m_arrayBufferView;
|
| -}
|
| -
|
| -void ArrayBufferOrArrayBufferViewOrDictionary::setArrayBufferView(PassRefPtr<TestArrayBufferView> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBufferView = value;
|
| - m_type = SpecificTypeArrayBufferView;
|
| -}
|
| -
|
| -ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionary::fromArrayBufferView(PassRefPtr<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;
|
| -}
|
| -
|
| -void V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, ArrayBufferOrArrayBufferViewOrDictionary& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8ArrayBuffer::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBuffer(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8ArrayBufferView::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBufferView(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(Dictionary, cppValue, Dictionary(v8Value, isolate, exceptionState), exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - ArrayBufferOrArrayBufferViewOrDictionary impl;
|
| - V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (v8Value->IsBoolean()) {
|
| - impl.setBoolean(v8Value->ToBoolean()->Value());
|
| - return;
|
| - }
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState);
|
| - impl.setUnrestrictedDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - BooleanOrStringOrUnrestrictedDouble impl;
|
| - V8BooleanOrStringOrUnrestrictedDouble::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -void V8DoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, DoubleOrString& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Value, exceptionState), exceptionState);
|
| - impl.setDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - DoubleOrString impl;
|
| - V8DoubleOrString::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -NodeOrNodeList::NodeOrNodeList()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -PassRefPtrWillBeRawPtr<Node> NodeOrNodeList::getAsNode() const
|
| -{
|
| - ASSERT(isNode());
|
| - return m_node;
|
| -}
|
| -
|
| -void NodeOrNodeList::setNode(PassRefPtrWillBeRawPtr<Node> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_node = value;
|
| - m_type = SpecificTypeNode;
|
| -}
|
| -
|
| -NodeOrNodeList NodeOrNodeList::fromNode(PassRefPtrWillBeRawPtr<Node> value)
|
| -{
|
| - NodeOrNodeList container;
|
| - container.setNode(value);
|
| - return container;
|
| -}
|
| -
|
| -PassRefPtrWillBeRawPtr<NodeList> NodeOrNodeList::getAsNodeList() const
|
| -{
|
| - ASSERT(isNodeList());
|
| - return m_nodeList;
|
| -}
|
| -
|
| -void NodeOrNodeList::setNodeList(PassRefPtrWillBeRawPtr<NodeList> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_nodeList = value;
|
| - m_type = SpecificTypeNodeList;
|
| -}
|
| -
|
| -NodeOrNodeList NodeOrNodeList::fromNodeList(PassRefPtrWillBeRawPtr<NodeList> value)
|
| -{
|
| - NodeOrNodeList container;
|
| - container.setNodeList(value);
|
| - return container;
|
| -}
|
| -
|
| -DEFINE_TRACE(NodeOrNodeList)
|
| -{
|
| - visitor->trace(m_node);
|
| - visitor->trace(m_nodeList);
|
| -}
|
| -
|
| -void V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, NodeOrNodeList& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8Node::hasInstance(v8Value, isolate)) {
|
| - RefPtrWillBeRawPtr<Node> cppValue = V8Node::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setNode(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8NodeList::hasInstance(v8Value, isolate)) {
|
| - RefPtrWillBeRawPtr<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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - NodeOrNodeList impl;
|
| - V8NodeOrNodeList::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -PassRefPtr<TestArrayBuffer> StringOrArrayBufferOrArrayBufferView::getAsArrayBuffer() const
|
| -{
|
| - ASSERT(isArrayBuffer());
|
| - return m_arrayBuffer;
|
| -}
|
| -
|
| -void StringOrArrayBufferOrArrayBufferView::setArrayBuffer(PassRefPtr<TestArrayBuffer> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBuffer = value;
|
| - m_type = SpecificTypeArrayBuffer;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromArrayBuffer(PassRefPtr<TestArrayBuffer> value)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView container;
|
| - container.setArrayBuffer(value);
|
| - return container;
|
| -}
|
| -
|
| -PassRefPtr<TestArrayBufferView> StringOrArrayBufferOrArrayBufferView::getAsArrayBufferView() const
|
| -{
|
| - ASSERT(isArrayBufferView());
|
| - return m_arrayBufferView;
|
| -}
|
| -
|
| -void StringOrArrayBufferOrArrayBufferView::setArrayBufferView(PassRefPtr<TestArrayBufferView> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_arrayBufferView = value;
|
| - m_type = SpecificTypeArrayBufferView;
|
| -}
|
| -
|
| -StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromArrayBufferView(PassRefPtr<TestArrayBufferView> value)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView container;
|
| - container.setArrayBufferView(value);
|
| - return container;
|
| -}
|
| -
|
| -void V8StringOrArrayBufferOrArrayBufferView::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrArrayBufferOrArrayBufferView& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8ArrayBuffer::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBuffer(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8ArrayBufferView::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setArrayBufferView(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - StringOrArrayBufferOrArrayBufferView impl;
|
| - V8StringOrArrayBufferOrArrayBufferView::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrDouble& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Value, exceptionState), exceptionState);
|
| - impl.setDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - StringOrDouble impl;
|
| - V8StringOrDouble::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -void V8StringOrStringSequence::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrStringSequence& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (v8Value->IsArray()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(Vector<String>, cppValue, toImplArray<String>(v8Value, 0, isolate, exceptionState), exceptionState);
|
| - impl.setStringSequence(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - StringOrStringSequence impl;
|
| - V8StringOrStringSequence::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestEnumOrDouble::TestEnumOrDouble()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -String TestEnumOrDouble::getAsTestEnum() const
|
| -{
|
| - ASSERT(isTestEnum());
|
| - return m_testEnum;
|
| -}
|
| -
|
| -void TestEnumOrDouble::setTestEnum(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - String string = value;
|
| - if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) {
|
| - 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;
|
| -}
|
| -
|
| -void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestEnumOrDouble& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Value, exceptionState), exceptionState);
|
| - impl.setDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - String string = cppValue;
|
| - if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) {
|
| - exceptionState.throwTypeError("'" + string + "' is not a valid enum value.");
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - TestEnumOrDouble impl;
|
| - V8TestEnumOrDouble::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array::TestInterface2OrUint8Array()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -PassRefPtr<TestInterface2> TestInterface2OrUint8Array::getAsTestInterface2() const
|
| -{
|
| - ASSERT(isTestInterface2());
|
| - return m_testInterface2;
|
| -}
|
| -
|
| -void TestInterface2OrUint8Array::setTestInterface2(PassRefPtr<TestInterface2> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterface2 = value;
|
| - m_type = SpecificTypeTestInterface2;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array TestInterface2OrUint8Array::fromTestInterface2(PassRefPtr<TestInterface2> value)
|
| -{
|
| - TestInterface2OrUint8Array container;
|
| - container.setTestInterface2(value);
|
| - return container;
|
| -}
|
| -
|
| -PassRefPtr<DOMUint8Array> TestInterface2OrUint8Array::getAsUint8Array() const
|
| -{
|
| - ASSERT(isUint8Array());
|
| - return m_uint8Array;
|
| -}
|
| -
|
| -void TestInterface2OrUint8Array::setUint8Array(PassRefPtr<DOMUint8Array> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_uint8Array = value;
|
| - m_type = SpecificTypeUint8Array;
|
| -}
|
| -
|
| -TestInterface2OrUint8Array TestInterface2OrUint8Array::fromUint8Array(PassRefPtr<DOMUint8Array> value)
|
| -{
|
| - TestInterface2OrUint8Array container;
|
| - container.setUint8Array(value);
|
| - return container;
|
| -}
|
| -
|
| -void V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterface2OrUint8Array& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8TestInterface2::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestInterface2> cppValue = V8TestInterface2::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterface2(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8Uint8Array::hasInstance(v8Value, isolate)) {
|
| - RefPtr<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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - TestInterface2OrUint8Array impl;
|
| - V8TestInterface2OrUint8Array::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -DEFINE_TRACE(TestInterfaceGarbageCollectedOrString)
|
| -{
|
| - visitor->trace(m_testInterfaceGarbageCollected);
|
| -}
|
| -
|
| -void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) {
|
| - RawPtr<TestInterfaceGarbageCollected> cppValue = V8TestInterfaceGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterfaceGarbageCollected(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceGarbageCollectedOrString impl;
|
| - V8TestInterfaceGarbageCollectedOrString::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterfaceOrLong::TestInterfaceOrLong()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -PassRefPtr<TestInterfaceImplementation> TestInterfaceOrLong::getAsTestInterface() const
|
| -{
|
| - ASSERT(isTestInterface());
|
| - return m_testInterface;
|
| -}
|
| -
|
| -void TestInterfaceOrLong::setTestInterface(PassRefPtr<TestInterfaceImplementation> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterface = value;
|
| - m_type = SpecificTypeTestInterface;
|
| -}
|
| -
|
| -TestInterfaceOrLong TestInterfaceOrLong::fromTestInterface(PassRefPtr<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;
|
| -}
|
| -
|
| -void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrLong& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8TestInterface::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterface(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
|
| - impl.setLong(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceOrLong impl;
|
| - V8TestInterfaceOrLong::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -PassRefPtr<TestInterfaceImplementation> TestInterfaceOrTestInterfaceEmpty::getAsTestInterface() const
|
| -{
|
| - ASSERT(isTestInterface());
|
| - return m_testInterface;
|
| -}
|
| -
|
| -void TestInterfaceOrTestInterfaceEmpty::setTestInterface(PassRefPtr<TestInterfaceImplementation> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterface = value;
|
| - m_type = SpecificTypeTestInterface;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInterface(PassRefPtr<TestInterfaceImplementation> value)
|
| -{
|
| - TestInterfaceOrTestInterfaceEmpty container;
|
| - container.setTestInterface(value);
|
| - return container;
|
| -}
|
| -
|
| -PassRefPtr<TestInterfaceEmpty> TestInterfaceOrTestInterfaceEmpty::getAsTestInterfaceEmpty() const
|
| -{
|
| - ASSERT(isTestInterfaceEmpty());
|
| - return m_testInterfaceEmpty;
|
| -}
|
| -
|
| -void TestInterfaceOrTestInterfaceEmpty::setTestInterfaceEmpty(PassRefPtr<TestInterfaceEmpty> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterfaceEmpty = value;
|
| - m_type = SpecificTypeTestInterfaceEmpty;
|
| -}
|
| -
|
| -TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInterfaceEmpty(PassRefPtr<TestInterfaceEmpty> value)
|
| -{
|
| - TestInterfaceOrTestInterfaceEmpty container;
|
| - container.setTestInterfaceEmpty(value);
|
| - return container;
|
| -}
|
| -
|
| -void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8TestInterface::hasInstance(v8Value, isolate)) {
|
| - RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterface(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) {
|
| - RefPtr<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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceOrTestInterfaceEmpty impl;
|
| - V8TestInterfaceOrTestInterfaceEmpty::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -TestInterfaceWillBeGarbageCollectedOrTestDictionary::TestInterfaceWillBeGarbageCollectedOrTestDictionary()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| -
|
| -PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> TestInterfaceWillBeGarbageCollectedOrTestDictionary::getAsTestInterfaceWillBeGarbageCollected() const
|
| -{
|
| - ASSERT(isTestInterfaceWillBeGarbageCollected());
|
| - return m_testInterfaceWillBeGarbageCollected;
|
| -}
|
| -
|
| -void TestInterfaceWillBeGarbageCollectedOrTestDictionary::setTestInterfaceWillBeGarbageCollected(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testInterfaceWillBeGarbageCollected = value;
|
| - m_type = SpecificTypeTestInterfaceWillBeGarbageCollected;
|
| -}
|
| -
|
| -TestInterfaceWillBeGarbageCollectedOrTestDictionary TestInterfaceWillBeGarbageCollectedOrTestDictionary::fromTestInterfaceWillBeGarbageCollected(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> value)
|
| -{
|
| - TestInterfaceWillBeGarbageCollectedOrTestDictionary container;
|
| - container.setTestInterfaceWillBeGarbageCollected(value);
|
| - return container;
|
| -}
|
| -
|
| -TestDictionary TestInterfaceWillBeGarbageCollectedOrTestDictionary::getAsTestDictionary() const
|
| -{
|
| - ASSERT(isTestDictionary());
|
| - return m_testDictionary;
|
| -}
|
| -
|
| -void TestInterfaceWillBeGarbageCollectedOrTestDictionary::setTestDictionary(TestDictionary value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_testDictionary = value;
|
| - m_type = SpecificTypeTestDictionary;
|
| -}
|
| -
|
| -TestInterfaceWillBeGarbageCollectedOrTestDictionary TestInterfaceWillBeGarbageCollectedOrTestDictionary::fromTestDictionary(TestDictionary value)
|
| -{
|
| - TestInterfaceWillBeGarbageCollectedOrTestDictionary container;
|
| - container.setTestDictionary(value);
|
| - return container;
|
| -}
|
| -
|
| -DEFINE_TRACE(TestInterfaceWillBeGarbageCollectedOrTestDictionary)
|
| -{
|
| - visitor->trace(m_testInterfaceWillBeGarbageCollected);
|
| - visitor->trace(m_testDictionary);
|
| -}
|
| -
|
| -void V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceWillBeGarbageCollectedOrTestDictionary& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (V8TestInterfaceWillBeGarbageCollected::hasInstance(v8Value, isolate)) {
|
| - RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> cppValue = V8TestInterfaceWillBeGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| - impl.setTestInterfaceWillBeGarbageCollected(cppValue);
|
| - return;
|
| - }
|
| -
|
| - if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) {
|
| - TestDictionary cppValue;
|
| - TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(V8TestDictionary::toImpl(isolate, v8Value, cppValue, exceptionState), exceptionState);
|
| - impl.setTestDictionary(cppValue);
|
| - return;
|
| - }
|
| -
|
| - exceptionState.throwTypeError("The provided value is not of type '(TestInterfaceWillBeGarbageCollected or TestDictionary)'");
|
| -}
|
| -
|
| -v8::Local<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOrTestDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| - case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| - case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestInterfaceWillBeGarbageCollected:
|
| - return toV8(impl.getAsTestInterfaceWillBeGarbageCollected(), creationContext, isolate);
|
| - case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestDictionary:
|
| - return toV8(impl.getAsTestDictionary(), creationContext, isolate);
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| -}
|
| -
|
| -TestInterfaceWillBeGarbageCollectedOrTestDictionary NativeValueTraits<TestInterfaceWillBeGarbageCollectedOrTestDictionary>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - TestInterfaceWillBeGarbageCollectedOrTestDictionary impl;
|
| - V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(isolate, value, impl, 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;
|
| -}
|
| -
|
| -void V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, UnrestrictedDoubleOrString& impl, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState);
|
| - impl.setUnrestrictedDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState);
|
| - 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(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| -{
|
| - UnrestrictedDoubleOrString impl;
|
| - V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, exceptionState);
|
| - return impl;
|
| -}
|
| -
|
| -} // namespace blink
|
| +#include "bindings/core/v8/ArrayBufferOrArrayBufferViewOrDictionary.cpp"
|
| +#include "bindings/core/v8/BooleanOrStringOrUnrestrictedDouble.cpp"
|
| +#include "bindings/core/v8/DoubleOrString.cpp"
|
| +#include "bindings/core/v8/NodeOrNodeList.cpp"
|
| +#include "bindings/core/v8/StringOrArrayBufferOrArrayBufferView.cpp"
|
| +#include "bindings/core/v8/StringOrDouble.cpp"
|
| +#include "bindings/core/v8/StringOrStringSequence.cpp"
|
| +#include "bindings/core/v8/TestEnumOrDouble.cpp"
|
| +#include "bindings/core/v8/TestInterface2OrUint8Array.cpp"
|
| +#include "bindings/core/v8/TestInterfaceGarbageCollectedOrString.cpp"
|
| +#include "bindings/core/v8/TestInterfaceOrLong.cpp"
|
| +#include "bindings/core/v8/TestInterfaceOrTestInterfaceEmpty.cpp"
|
| +#include "bindings/core/v8/TestInterfaceWillBeGarbageCollectedOrTestDictionary.cpp"
|
| +#include "bindings/core/v8/UnrestrictedDoubleOrString.cpp"
|
|
|