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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.h

Issue 2746713003: bindings: Add support for nested union types (Closed)
Patch Set: Improve documentation 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/DoubleOrStringOrDoubleOrStringSequence.h
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.h b/third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c725efd31cdc04889397f4414346895872dc01d
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.h
@@ -0,0 +1,101 @@
+// 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.h.tmpl
+
+// clang-format off
+#ifndef DoubleOrStringOrDoubleOrStringSequence_h
+#define DoubleOrStringOrDoubleOrStringSequence_h
+
+#include "bindings/core/v8/Dictionary.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/NativeValueTraits.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "core/CoreExport.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class CORE_EXPORT DoubleOrStringOrDoubleOrStringSequence final {
+ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
+ public:
+ DoubleOrStringOrDoubleOrStringSequence();
+ bool isNull() const { return m_type == SpecificTypeNone; }
+
+ bool isDouble() const { return m_type == SpecificTypeDouble; }
+ double getAsDouble() const;
+ void setDouble(double);
+ static DoubleOrStringOrDoubleOrStringSequence fromDouble(double);
+
+ bool isDoubleOrStringSequence() const { return m_type == SpecificTypeDoubleOrStringSequence; }
+ const HeapVector<DoubleOrString>& getAsDoubleOrStringSequence() const;
+ void setDoubleOrStringSequence(const HeapVector<DoubleOrString>&);
+ static DoubleOrStringOrDoubleOrStringSequence fromDoubleOrStringSequence(const HeapVector<DoubleOrString>&);
+
+ bool isString() const { return m_type == SpecificTypeString; }
+ String getAsString() const;
+ void setString(String);
+ static DoubleOrStringOrDoubleOrStringSequence fromString(String);
+
+ DoubleOrStringOrDoubleOrStringSequence(const DoubleOrStringOrDoubleOrStringSequence&);
+ ~DoubleOrStringOrDoubleOrStringSequence();
+ DoubleOrStringOrDoubleOrStringSequence& operator=(const DoubleOrStringOrDoubleOrStringSequence&);
+ DECLARE_TRACE();
+
+ private:
+ enum SpecificTypes {
+ SpecificTypeNone,
+ SpecificTypeDouble,
+ SpecificTypeDoubleOrStringSequence,
+ SpecificTypeString,
+ };
+ SpecificTypes m_type;
+
+ double m_double;
+ HeapVector<DoubleOrString> m_doubleOrStringSequence;
+ String m_string;
+
+ friend CORE_EXPORT v8::Local<v8::Value> ToV8(const DoubleOrStringOrDoubleOrStringSequence&, v8::Local<v8::Object>, v8::Isolate*);
+};
+
+class V8DoubleOrStringOrDoubleOrStringSequence final {
+ public:
+ CORE_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, DoubleOrStringOrDoubleOrStringSequence&, UnionTypeConversionMode, ExceptionState&);
+};
+
+CORE_EXPORT v8::Local<v8::Value> ToV8(const DoubleOrStringOrDoubleOrStringSequence&, v8::Local<v8::Object>, v8::Isolate*);
+
+template <class CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DoubleOrStringOrDoubleOrStringSequence& impl) {
+ v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template <class CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DoubleOrStringOrDoubleOrStringSequence& impl, v8::Local<v8::Object> creationContext) {
+ v8SetReturnValue(callbackInfo, ToV8(impl, creationContext, callbackInfo.GetIsolate()));
+}
+
+template <>
+struct NativeValueTraits<DoubleOrStringOrDoubleOrStringSequence> : public NativeValueTraitsBase<DoubleOrStringOrDoubleOrStringSequence> {
+ CORE_EXPORT static DoubleOrStringOrDoubleOrStringSequence nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&);
+};
+
+template <>
+struct V8TypeOf<DoubleOrStringOrDoubleOrStringSequence> {
+ typedef V8DoubleOrStringOrDoubleOrStringSequence Type;
+};
+
+} // namespace blink
+
+// We need to set canInitializeWithMemset=true because HeapVector supports
+// items that can initialize with memset or have a vtable. It is safe to
+// set canInitializeWithMemset=true for a union type object in practice.
+// See https://codereview.chromium.org/1118993002/#msg5 for more details.
+WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::DoubleOrStringOrDoubleOrStringSequence);
+
+#endif // DoubleOrStringOrDoubleOrStringSequence_h

Powered by Google App Engine
This is Rietveld 408576698