| Index: third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp b/third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7e5e41dada620b2b934ba735c5b66c20eac630d4
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp
|
| @@ -0,0 +1,109 @@
|
| +// 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 "LongSequenceOrEvent.h"
|
| +
|
| +#include "bindings/core/v8/IDLTypes.h"
|
| +#include "bindings/core/v8/NativeValueTraitsImpl.h"
|
| +#include "bindings/core/v8/ToV8.h"
|
| +#include "bindings/core/v8/V8Event.h"
|
| +
|
| +namespace blink {
|
| +
|
| +LongSequenceOrEvent::LongSequenceOrEvent() : m_type(SpecificTypeNone) {}
|
| +
|
| +Event* LongSequenceOrEvent::getAsEvent() const {
|
| + DCHECK(isEvent());
|
| + return m_event;
|
| +}
|
| +
|
| +void LongSequenceOrEvent::setEvent(Event* value) {
|
| + DCHECK(isNull());
|
| + m_event = value;
|
| + m_type = SpecificTypeEvent;
|
| +}
|
| +
|
| +LongSequenceOrEvent LongSequenceOrEvent::fromEvent(Event* value) {
|
| + LongSequenceOrEvent container;
|
| + container.setEvent(value);
|
| + return container;
|
| +}
|
| +
|
| +const Vector<int32_t>& LongSequenceOrEvent::getAsLongSequence() const {
|
| + DCHECK(isLongSequence());
|
| + return m_longSequence;
|
| +}
|
| +
|
| +void LongSequenceOrEvent::setLongSequence(const Vector<int32_t>& value) {
|
| + DCHECK(isNull());
|
| + m_longSequence = value;
|
| + m_type = SpecificTypeLongSequence;
|
| +}
|
| +
|
| +LongSequenceOrEvent LongSequenceOrEvent::fromLongSequence(const Vector<int32_t>& value) {
|
| + LongSequenceOrEvent container;
|
| + container.setLongSequence(value);
|
| + return container;
|
| +}
|
| +
|
| +LongSequenceOrEvent::LongSequenceOrEvent(const LongSequenceOrEvent&) = default;
|
| +LongSequenceOrEvent::~LongSequenceOrEvent() = default;
|
| +LongSequenceOrEvent& LongSequenceOrEvent::operator=(const LongSequenceOrEvent&) = default;
|
| +
|
| +DEFINE_TRACE(LongSequenceOrEvent) {
|
| + visitor->trace(m_event);
|
| +}
|
| +
|
| +void V8LongSequenceOrEvent::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, LongSequenceOrEvent& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
|
| + if (v8Value.IsEmpty())
|
| + return;
|
| +
|
| + if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| + return;
|
| +
|
| + if (V8Event::hasInstance(v8Value, isolate)) {
|
| + Event* cppValue = V8Event::toImpl(v8::Local<v8::Object>::Cast(v8Value));
|
| + impl.setEvent(cppValue);
|
| + return;
|
| + }
|
| +
|
| + if (v8Value->IsArray()) {
|
| + Vector<int32_t> cppValue = toImplArray<Vector<int32_t>>(v8Value, 0, isolate, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setLongSequence(cppValue);
|
| + return;
|
| + }
|
| +
|
| + exceptionState.throwTypeError("The provided value is not of type '(sequence<long> or Event)'");
|
| +}
|
| +
|
| +v8::Local<v8::Value> ToV8(const LongSequenceOrEvent& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
|
| + switch (impl.m_type) {
|
| + case LongSequenceOrEvent::SpecificTypeNone:
|
| + return v8::Null(isolate);
|
| + case LongSequenceOrEvent::SpecificTypeEvent:
|
| + return ToV8(impl.getAsEvent(), creationContext, isolate);
|
| + case LongSequenceOrEvent::SpecificTypeLongSequence:
|
| + return ToV8(impl.getAsLongSequence(), creationContext, isolate);
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| + return v8::Local<v8::Value>();
|
| +}
|
| +
|
| +LongSequenceOrEvent NativeValueTraits<LongSequenceOrEvent>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| + LongSequenceOrEvent impl;
|
| + V8LongSequenceOrEvent::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| + return impl;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|