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

Unified Diff: Source/bindings/tests/results/core/TestInterfaceOrTestInterfaceEmpty.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/TestInterfaceOrTestInterfaceEmpty.cpp
diff --git a/Source/bindings/tests/results/core/TestInterfaceOrTestInterfaceEmpty.cpp b/Source/bindings/tests/results/core/TestInterfaceOrTestInterfaceEmpty.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a1fc7b8a134e2e3a2c3084e93b2c0052b18861ef
--- /dev/null
+++ b/Source/bindings/tests/results/core/TestInterfaceOrTestInterfaceEmpty.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 "TestInterfaceOrTestInterfaceEmpty.h"
+
+
+namespace blink {
+
+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;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698