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

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

Issue 699713003: IDL: ArrayBuffer and ArrayBufferView support for 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 4ca08a2119da2c54dccf1f2adf89c74da53a49c2..d665a566eb5886f1165b9aad1eadd593fdc74694 100644
--- a/Source/bindings/tests/results/core/UnionTypesCore.h
+++ b/Source/bindings/tests/results/core/UnionTypesCore.h
@@ -15,10 +15,12 @@ namespace blink {
class Node;
class NodeList;
+class TestArrayBuffer;
+class TestArrayBufferView;
class TestDictionary;
-class TestInterface;
class TestInterfaceEmpty;
class TestInterfaceGarbageCollected;
+class TestInterfaceImplementation;
class TestInterfaceWillBeGarbageCollected;
class BooleanOrStringOrUnrestrictedDouble final {
@@ -107,6 +109,51 @@ inline void v8SetReturnValue(const CallbackInfo& callbackInfo, NodeOrNodeList& i
v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
}
+class StringOrArrayBufferOrArrayBufferView final {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+public:
+ StringOrArrayBufferOrArrayBufferView();
+ bool isNull() const { return m_type == SpecificTypeNone; }
+
+ bool isString() const { return m_type == SpecificTypeString; }
+ String getAsString();
+ void setString(String);
+
+ bool isArrayBuffer() const { return m_type == SpecificTypeArrayBuffer; }
+ PassRefPtr<TestArrayBuffer> getAsArrayBuffer();
+ void setArrayBuffer(PassRefPtr<TestArrayBuffer>);
+
+ bool isArrayBufferView() const { return m_type == SpecificTypeArrayBufferView; }
+ PassRefPtr<TestArrayBufferView> getAsArrayBufferView();
+ void setArrayBufferView(PassRefPtr<TestArrayBufferView>);
+
+private:
+ enum SpecificTypes {
+ SpecificTypeNone,
+ SpecificTypeString,
+ SpecificTypeArrayBuffer,
+ SpecificTypeArrayBufferView,
+ };
+ SpecificTypes m_type;
+
+ String m_string;
+ RefPtr<TestArrayBuffer> m_arrayBuffer;
+ RefPtr<TestArrayBufferView> m_arrayBufferView;
+};
+
+class V8StringOrArrayBufferOrArrayBufferView final {
+public:
+ static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, StringOrArrayBufferOrArrayBufferView&, ExceptionState&);
+};
+
+v8::Handle<v8::Value> toV8(StringOrArrayBufferOrArrayBufferView&, v8::Handle<v8::Object>, v8::Isolate*);
+
+template <class CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrArrayBufferOrArrayBufferView& impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
class StringOrDouble final {
ALLOW_ONLY_INLINE_ALLOCATION();
public:

Powered by Google App Engine
This is Rietveld 408576698