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

Unified Diff: Source/bindings/tests/results/core/TestInterfaceOrLong.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/TestInterfaceOrLong.cpp
diff --git a/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp b/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9a2e67be3520b5191a4d3883623927ae6e8fdb17
--- /dev/null
+++ b/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp
@@ -0,0 +1,105 @@
+// 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 "TestInterfaceOrLong.h"
+
+
+namespace blink {
+
+TestInterfaceOrLong::TestInterfaceOrLong()
+ : m_type(SpecificTypeNone)
+{
+}
+
+PassRefPtr<TestInterfaceImplementation> TestInterfaceOrLong::getAsTestInterface() const
+{
+ ASSERT(isTestInterface());
+ return m_testInterface;
+}
+
+void TestInterfaceOrLong::setTestInterface(PassRefPtr<TestInterfaceImplementation> value)
+{
+ ASSERT(isNull());
+ m_testInterface = value;
+ m_type = SpecificTypeTestInterface;
+}
+
+TestInterfaceOrLong TestInterfaceOrLong::fromTestInterface(PassRefPtr<TestInterfaceImplementation> value)
+{
+ TestInterfaceOrLong container;
+ container.setTestInterface(value);
+ return container;
+}
+
+int TestInterfaceOrLong::getAsLong() const
+{
+ ASSERT(isLong());
+ return m_long;
+}
+
+void TestInterfaceOrLong::setLong(int value)
+{
+ ASSERT(isNull());
+ m_long = value;
+ m_type = SpecificTypeLong;
+}
+
+TestInterfaceOrLong TestInterfaceOrLong::fromLong(int value)
+{
+ TestInterfaceOrLong container;
+ container.setLong(value);
+ return container;
+}
+
+void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrLong& 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 (v8Value->IsNumber()) {
+ TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
+ impl.setLong(cppValue);
+ return;
+ }
+
+ {
+ TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
+ impl.setLong(cppValue);
+ return;
+ }
+
+}
+
+v8::Local<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ switch (impl.m_type) {
+ case TestInterfaceOrLong::SpecificTypeNone:
+ return v8::Null(isolate);
+ case TestInterfaceOrLong::SpecificTypeTestInterface:
+ return toV8(impl.getAsTestInterface(), creationContext, isolate);
+ case TestInterfaceOrLong::SpecificTypeLong:
+ return v8::Integer::New(isolate, impl.getAsLong());
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return v8::Local<v8::Value>();
+}
+
+TestInterfaceOrLong NativeValueTraits<TestInterfaceOrLong>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
+{
+ TestInterfaceOrLong impl;
+ V8TestInterfaceOrLong::toImpl(isolate, value, impl, exceptionState);
+ return impl;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698