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

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

Issue 713403004: IDL: Generic Dictionary support in union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 d729ac39165e71650040750f2773c745883bf09b..6ece485d80978f7a3afa275ccaabeca0984c0784 100644
--- a/Source/bindings/tests/results/core/UnionTypesCore.h
+++ b/Source/bindings/tests/results/core/UnionTypesCore.h
@@ -7,6 +7,7 @@
#ifndef UnionTypeCore_h
#define UnionTypeCore_h
+#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8Binding.h"
#include "platform/heap/Handle.h"
@@ -23,6 +24,58 @@ class TestInterfaceGarbageCollected;
class TestInterfaceImplementation;
class TestInterfaceWillBeGarbageCollected;
+class ArrayBufferOrArrayBufferViewOrDictionary final {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+public:
+ ArrayBufferOrArrayBufferViewOrDictionary();
+ bool isNull() const { return m_type == SpecificTypeNone; }
+
+ bool isArrayBuffer() const { return m_type == SpecificTypeArrayBuffer; }
+ PassRefPtr<TestArrayBuffer> getAsArrayBuffer() const;
+ void setArrayBuffer(PassRefPtr<TestArrayBuffer>);
+
+ bool isArrayBufferView() const { return m_type == SpecificTypeArrayBufferView; }
+ PassRefPtr<TestArrayBufferView> getAsArrayBufferView() const;
+ void setArrayBufferView(PassRefPtr<TestArrayBufferView>);
+
+ bool isDictionary() const { return m_type == SpecificTypeDictionary; }
+ Dictionary getAsDictionary() const;
+ void setDictionary(Dictionary);
+
+private:
+ enum SpecificTypes {
+ SpecificTypeNone,
+ SpecificTypeArrayBuffer,
+ SpecificTypeArrayBufferView,
+ SpecificTypeDictionary,
+ };
+ SpecificTypes m_type;
+
+ RefPtr<TestArrayBuffer> m_arrayBuffer;
+ RefPtr<TestArrayBufferView> m_arrayBufferView;
+ Dictionary m_dictionary;
+
+ friend v8::Handle<v8::Value> toV8(ArrayBufferOrArrayBufferViewOrDictionary&, v8::Handle<v8::Object>, v8::Isolate*);
+};
+
+class V8ArrayBufferOrArrayBufferViewOrDictionary final {
+public:
+ static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, ArrayBufferOrArrayBufferViewOrDictionary&, ExceptionState&);
+};
+
+v8::Handle<v8::Value> toV8(ArrayBufferOrArrayBufferViewOrDictionary&, v8::Handle<v8::Object>, v8::Isolate*);
+
+template <class CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ArrayBufferOrArrayBufferViewOrDictionary& impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template <>
+struct NativeValueTraits<ArrayBufferOrArrayBufferViewOrDictionary> {
+ static ArrayBufferOrArrayBufferViewOrDictionary nativeValue(const v8::Handle<v8::Value>&, v8::Isolate*, ExceptionState&);
+};
+
class BooleanOrStringOrUnrestrictedDouble final {
ALLOW_ONLY_INLINE_ALLOCATION();
public:

Powered by Google App Engine
This is Rietveld 408576698