Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: Source/bindings/tests/results/core/TestInterface2OrUint8Array.cpp

Issue 953123003: IDL: Put generated union type containers in separate files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/tests/results/core/TestInterface2OrUint8Array.cpp
diff --git a/Source/bindings/tests/results/core/TestInterface2OrUint8Array.cpp b/Source/bindings/tests/results/core/TestInterface2OrUint8Array.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8175f225be69842c8f6f5826eb8aba4a1bf0b2dd
--- /dev/null
+++ b/Source/bindings/tests/results/core/TestInterface2OrUint8Array.cpp
@@ -0,0 +1,100 @@
+// 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 "TestInterface2OrUint8Array.h"
+
+
+namespace blink {
+
+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;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698