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

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

Issue 854113002: IDL: Enumeration support in union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 d513788aebbb39a2e6d31a73b36a8fe0c90946e7..b6d407e95841ae3f126519866dab56b9c8e98c84 100644
--- a/Source/bindings/tests/results/core/UnionTypesCore.h
+++ b/Source/bindings/tests/results/core/UnionTypesCore.h
@@ -368,6 +368,52 @@ struct NativeValueTraits<StringOrStringSequence> {
static StringOrStringSequence nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
};
+class TestEnumOrDouble final {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+public:
+ TestEnumOrDouble();
+ bool isNull() const { return m_type == SpecificTypeNone; }
+
+ bool isTestEnum() const { return m_type == SpecificTypeTestEnum; }
+ String getAsTestEnum() const;
+ void setTestEnum(String);
+
+ bool isDouble() const { return m_type == SpecificTypeDouble; }
+ double getAsDouble() const;
+ void setDouble(double);
+
+private:
+ enum SpecificTypes {
+ SpecificTypeNone,
+ SpecificTypeTestEnum,
+ SpecificTypeDouble,
+ };
+ SpecificTypes m_type;
+
+ String m_testEnum;
+ double m_double;
+
+ friend v8::Local<v8::Value> toV8(const TestEnumOrDouble&, v8::Local<v8::Object>, v8::Isolate*);
+};
+
+class V8TestEnumOrDouble final {
+public:
+ static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestEnumOrDouble&, ExceptionState&);
+};
+
+v8::Local<v8::Value> toV8(const TestEnumOrDouble&, v8::Local<v8::Object>, v8::Isolate*);
+
+template <class CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestEnumOrDouble& impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template <>
+struct NativeValueTraits<TestEnumOrDouble> {
+ static TestEnumOrDouble nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
+};
+
class TestInterface2OrUint8Array final {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
« no previous file with comments | « Source/bindings/tests/idls/core/TestObject.idl ('k') | Source/bindings/tests/results/core/UnionTypesCore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698