Index: Source/bindings/tests/results/core/NodeOrNodeList.cpp |
diff --git a/Source/bindings/tests/results/core/NodeOrNodeList.cpp b/Source/bindings/tests/results/core/NodeOrNodeList.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..515731c3ff064df632efd033f0672bbaede6f1f8 |
--- /dev/null |
+++ b/Source/bindings/tests/results/core/NodeOrNodeList.cpp |
@@ -0,0 +1,106 @@ |
+// 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 "NodeOrNodeList.h" |
+ |
+ |
+namespace blink { |
+ |
+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; |
+} |
+ |
+} // namespace blink |