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

Unified Diff: Source/bindings/tests/results/core/UnionTypesCore.h

Issue 1063253005: bindings: Use Visitor to collect union types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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/UnionTypesCore.h
diff --git a/Source/bindings/tests/results/core/UnionTypesCore.h b/Source/bindings/tests/results/core/UnionTypesCore.h
index 40bf1f9b634c25d93d7a6dd008c5f26a589e9260..0f88f23e4e5c8c45a803dab88ee8136774508f93 100644
--- a/Source/bindings/tests/results/core/UnionTypesCore.h
+++ b/Source/bindings/tests/results/core/UnionTypesCore.h
@@ -209,6 +209,64 @@ struct NativeValueTraits<DoubleOrString> {
static DoubleOrString nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&);
};
+class CORE_EXPORT LongOrTestDictionary final {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+public:
+ LongOrTestDictionary();
+ bool isNull() const { return m_type == SpecificTypeNone; }
+
+ bool isLong() const { return m_type == SpecificTypeLong; }
+ int getAsLong() const;
+ void setLong(int);
+ static LongOrTestDictionary fromLong(int);
+
+ bool isTestDictionary() const { return m_type == SpecificTypeTestDictionary; }
+ TestDictionary getAsTestDictionary() const;
+ void setTestDictionary(TestDictionary);
+ static LongOrTestDictionary fromTestDictionary(TestDictionary);
+
+#if COMPILER(MSVC) && defined(COMPONENT_BUILD) && LINK_CORE_MODULES_SEPARATELY
+ // Explicit declarations of copy constructor, destructor and operator=,
+ // because msvc automatically generates them if they are not declared in
+ // this header.
+ LongOrTestDictionary(const LongOrTestDictionary&);
+ ~LongOrTestDictionary();
+ LongOrTestDictionary& operator=(const LongOrTestDictionary&);
+#endif
+ DECLARE_TRACE();
+
+private:
+ enum SpecificTypes {
+ SpecificTypeNone,
+ SpecificTypeLong,
+ SpecificTypeTestDictionary,
+ };
+ SpecificTypes m_type;
+
+ int m_long;
+ TestDictionary m_testDictionary;
+
+ friend CORE_EXPORT v8::Local<v8::Value> toV8(const LongOrTestDictionary&, v8::Local<v8::Object>, v8::Isolate*);
+};
+
+class V8LongOrTestDictionary final {
+public:
+ CORE_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, LongOrTestDictionary&, ExceptionState&);
+};
+
+CORE_EXPORT v8::Local<v8::Value> toV8(const LongOrTestDictionary&, v8::Local<v8::Object>, v8::Isolate*);
+
+template <class CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, LongOrTestDictionary& impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template <>
+struct NativeValueTraits<LongOrTestDictionary> {
+ static LongOrTestDictionary nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&);
+};
+
class CORE_EXPORT NodeOrNodeList final {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
« no previous file with comments | « Source/bindings/tests/idls/core/TestInterfaceConstructor.idl ('k') | Source/bindings/tests/results/core/UnionTypesCore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698