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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.cpp

Issue 2749253002: bindings: Expand typedefs before generating union files. (Closed)
Patch Set: Created 3 years, 9 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: third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8421b50c922cc0c00d794474691027639e658b27
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrTestCallbackInterface.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 "BooleanOrTestCallbackInterface.h"
+
+#include "bindings/core/v8/IDLTypes.h"
+#include "bindings/core/v8/NativeValueTraitsImpl.h"
+#include "bindings/core/v8/ToV8.h"
+#include "bindings/core/v8/V8TestCallbackInterface.h"
+
+namespace blink {
+
+BooleanOrTestCallbackInterface::BooleanOrTestCallbackInterface() : m_type(SpecificTypeNone) {}
+
+bool BooleanOrTestCallbackInterface::getAsBoolean() const {
+ DCHECK(isBoolean());
+ return m_boolean;
+}
+
+void BooleanOrTestCallbackInterface::setBoolean(bool value) {
+ DCHECK(isNull());
+ m_boolean = value;
+ m_type = SpecificTypeBoolean;
+}
+
+BooleanOrTestCallbackInterface BooleanOrTestCallbackInterface::fromBoolean(bool value) {
+ BooleanOrTestCallbackInterface container;
+ container.setBoolean(value);
+ return container;
+}
+
+TestCallbackInterface* BooleanOrTestCallbackInterface::getAsTestCallbackInterface() const {
+ DCHECK(isTestCallbackInterface());
+ return m_testCallbackInterface;
+}
+
+void BooleanOrTestCallbackInterface::setTestCallbackInterface(TestCallbackInterface* value) {
+ DCHECK(isNull());
+ m_testCallbackInterface = value;
+ m_type = SpecificTypeTestCallbackInterface;
+}
+
+BooleanOrTestCallbackInterface BooleanOrTestCallbackInterface::fromTestCallbackInterface(TestCallbackInterface* value) {
+ BooleanOrTestCallbackInterface container;
+ container.setTestCallbackInterface(value);
+ return container;
+}
+
+BooleanOrTestCallbackInterface::BooleanOrTestCallbackInterface(const BooleanOrTestCallbackInterface&) = default;
+BooleanOrTestCallbackInterface::~BooleanOrTestCallbackInterface() = default;
+BooleanOrTestCallbackInterface& BooleanOrTestCallbackInterface::operator=(const BooleanOrTestCallbackInterface&) = default;
+
+DEFINE_TRACE(BooleanOrTestCallbackInterface) {
+ visitor->trace(m_testCallbackInterface);
+}
+
+void V8BooleanOrTestCallbackInterface::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, BooleanOrTestCallbackInterface& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
+ if (v8Value.IsEmpty())
+ return;
+
+ if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
+ return;
+
+ if (V8TestCallbackInterface::hasInstance(v8Value, isolate)) {
+ TestCallbackInterface* cppValue = V8TestCallbackInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
+ impl.setTestCallbackInterface(cppValue);
+ return;
+ }
+
+ if (v8Value->IsBoolean()) {
+ impl.setBoolean(v8Value.As<v8::Boolean>()->Value());
+ return;
+ }
+
+ {
+ impl.setBoolean(v8Value->BooleanValue());
+ return;
+ }
+}
+
+v8::Local<v8::Value> ToV8(const BooleanOrTestCallbackInterface& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
+ switch (impl.m_type) {
+ case BooleanOrTestCallbackInterface::SpecificTypeNone:
+ return v8::Null(isolate);
+ case BooleanOrTestCallbackInterface::SpecificTypeBoolean:
+ return v8Boolean(impl.getAsBoolean(), isolate);
+ case BooleanOrTestCallbackInterface::SpecificTypeTestCallbackInterface:
+ return ToV8(impl.getAsTestCallbackInterface(), creationContext, isolate);
+ default:
+ NOTREACHED();
+ }
+ return v8::Local<v8::Value>();
+}
+
+BooleanOrTestCallbackInterface NativeValueTraits<BooleanOrTestCallbackInterface>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
+ BooleanOrTestCallbackInterface impl;
+ V8BooleanOrTestCallbackInterface::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
+ return impl;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698