| Index: third_party/WebKit/Source/bindings/tests/results/core/UnsignedLongLongOrBooleanOrTestCallbackInterface.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/UnsignedLongLongOrBooleanOrTestCallbackInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/UnsignedLongLongOrBooleanOrTestCallbackInterface.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c19e6940a3b75f734ed4628c32737b2f51439a84
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/UnsignedLongLongOrBooleanOrTestCallbackInterface.cpp
|
| @@ -0,0 +1,139 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// This file has been auto-generated by code_generator_v8.py.
|
| +// DO NOT MODIFY!
|
| +
|
| +// This file has been generated from the Jinja2 template in
|
| +// third_party/WebKit/Source/bindings/templates/union_container.cpp.tmpl
|
| +
|
| +// clang-format off
|
| +#include "UnsignedLongLongOrBooleanOrTestCallbackInterface.h"
|
| +
|
| +#include "bindings/core/v8/IDLTypes.h"
|
| +#include "bindings/core/v8/NativeValueTraitsImpl.h"
|
| +#include "bindings/core/v8/ToV8.h"
|
| +#include "bindings/core/v8/V8TestCallbackInterface.h"
|
| +
|
| +namespace blink {
|
| +
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface::UnsignedLongLongOrBooleanOrTestCallbackInterface() : m_type(SpecificTypeNone) {}
|
| +
|
| +bool UnsignedLongLongOrBooleanOrTestCallbackInterface::getAsBoolean() const {
|
| + DCHECK(isBoolean());
|
| + return m_boolean;
|
| +}
|
| +
|
| +void UnsignedLongLongOrBooleanOrTestCallbackInterface::setBoolean(bool value) {
|
| + DCHECK(isNull());
|
| + m_boolean = value;
|
| + m_type = SpecificTypeBoolean;
|
| +}
|
| +
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface UnsignedLongLongOrBooleanOrTestCallbackInterface::fromBoolean(bool value) {
|
| + UnsignedLongLongOrBooleanOrTestCallbackInterface container;
|
| + container.setBoolean(value);
|
| + return container;
|
| +}
|
| +
|
| +TestCallbackInterface* UnsignedLongLongOrBooleanOrTestCallbackInterface::getAsTestCallbackInterface() const {
|
| + DCHECK(isTestCallbackInterface());
|
| + return m_testCallbackInterface;
|
| +}
|
| +
|
| +void UnsignedLongLongOrBooleanOrTestCallbackInterface::setTestCallbackInterface(TestCallbackInterface* value) {
|
| + DCHECK(isNull());
|
| + m_testCallbackInterface = value;
|
| + m_type = SpecificTypeTestCallbackInterface;
|
| +}
|
| +
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface UnsignedLongLongOrBooleanOrTestCallbackInterface::fromTestCallbackInterface(TestCallbackInterface* value) {
|
| + UnsignedLongLongOrBooleanOrTestCallbackInterface container;
|
| + container.setTestCallbackInterface(value);
|
| + return container;
|
| +}
|
| +
|
| +uint64_t UnsignedLongLongOrBooleanOrTestCallbackInterface::getAsUnsignedLongLong() const {
|
| + DCHECK(isUnsignedLongLong());
|
| + return m_unsignedLongLong;
|
| +}
|
| +
|
| +void UnsignedLongLongOrBooleanOrTestCallbackInterface::setUnsignedLongLong(uint64_t value) {
|
| + DCHECK(isNull());
|
| + m_unsignedLongLong = value;
|
| + m_type = SpecificTypeUnsignedLongLong;
|
| +}
|
| +
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface UnsignedLongLongOrBooleanOrTestCallbackInterface::fromUnsignedLongLong(uint64_t value) {
|
| + UnsignedLongLongOrBooleanOrTestCallbackInterface container;
|
| + container.setUnsignedLongLong(value);
|
| + return container;
|
| +}
|
| +
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface::UnsignedLongLongOrBooleanOrTestCallbackInterface(const UnsignedLongLongOrBooleanOrTestCallbackInterface&) = default;
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface::~UnsignedLongLongOrBooleanOrTestCallbackInterface() = default;
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface& UnsignedLongLongOrBooleanOrTestCallbackInterface::operator=(const UnsignedLongLongOrBooleanOrTestCallbackInterface&) = default;
|
| +
|
| +DEFINE_TRACE(UnsignedLongLongOrBooleanOrTestCallbackInterface) {
|
| + visitor->trace(m_testCallbackInterface);
|
| +}
|
| +
|
| +void V8UnsignedLongLongOrBooleanOrTestCallbackInterface::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, UnsignedLongLongOrBooleanOrTestCallbackInterface& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
|
| + if (v8Value.IsEmpty())
|
| + return;
|
| +
|
| + if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| + return;
|
| +
|
| + if (V8TestCallbackInterface::hasInstance(v8Value, isolate)) {
|
| + TestCallbackInterface* cppValue = V8TestCallbackInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| + impl.setTestCallbackInterface(cppValue);
|
| + return;
|
| + }
|
| +
|
| + if (v8Value->IsBoolean()) {
|
| + impl.setBoolean(v8Value.As<v8::Boolean>()->Value());
|
| + return;
|
| + }
|
| +
|
| + if (v8Value->IsNumber()) {
|
| + uint64_t cppValue = NativeValueTraits<IDLUnsignedLongLong>::nativeValue(isolate, v8Value, exceptionState, NormalConversion);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setUnsignedLongLong(cppValue);
|
| + return;
|
| + }
|
| +
|
| + {
|
| + uint64_t cppValue = NativeValueTraits<IDLUnsignedLongLong>::nativeValue(isolate, v8Value, exceptionState, NormalConversion);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setUnsignedLongLong(cppValue);
|
| + return;
|
| + }
|
| +}
|
| +
|
| +v8::Local<v8::Value> ToV8(const UnsignedLongLongOrBooleanOrTestCallbackInterface& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
|
| + switch (impl.m_type) {
|
| + case UnsignedLongLongOrBooleanOrTestCallbackInterface::SpecificTypeNone:
|
| + return v8::Null(isolate);
|
| + case UnsignedLongLongOrBooleanOrTestCallbackInterface::SpecificTypeBoolean:
|
| + return v8Boolean(impl.getAsBoolean(), isolate);
|
| + case UnsignedLongLongOrBooleanOrTestCallbackInterface::SpecificTypeTestCallbackInterface:
|
| + return ToV8(impl.getAsTestCallbackInterface(), creationContext, isolate);
|
| + case UnsignedLongLongOrBooleanOrTestCallbackInterface::SpecificTypeUnsignedLongLong:
|
| + return v8::Number::New(isolate, static_cast<double>(impl.getAsUnsignedLongLong()));
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| + return v8::Local<v8::Value>();
|
| +}
|
| +
|
| +UnsignedLongLongOrBooleanOrTestCallbackInterface NativeValueTraits<UnsignedLongLongOrBooleanOrTestCallbackInterface>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| + UnsignedLongLongOrBooleanOrTestCallbackInterface impl;
|
| + V8UnsignedLongLongOrBooleanOrTestCallbackInterface::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| + return impl;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|