Chromium Code Reviews| 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 59d2429fc17a4c01e825a79b8b12ba0dda17c87c..6c1d925bb341b715557348032ae5f8a4bed8952e 100644 |
| --- a/Source/bindings/tests/results/core/UnionTypesCore.h |
| +++ b/Source/bindings/tests/results/core/UnionTypesCore.h |
| @@ -7,32 +7,260 @@ |
| #ifndef UnionTypeCore_h |
| #define UnionTypeCore_h |
| +#include "bindings/core/v8/ExceptionState.h" |
| +#include "bindings/core/v8/V8Binding.h" |
| +#include "platform/heap/Handle.h" |
| + |
| namespace blink { |
| +class Node; |
| +class NodeList; |
| +class TestDictionary; |
| +class TestInterface; |
| +class TestInterfaceEmpty; |
| +class TestInterfaceGarbageCollected; |
| +class TestInterfaceWillBeGarbageCollected; |
| + |
| class LongSequenceOrStringArrayOrUnrestrictedDouble final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| +public: |
| + LongSequenceOrStringArrayOrUnrestrictedDouble(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + bool isLongSequence() const { return m_type == SpecificTypeLongSequence; } |
| + const Vector<int>& getAsLongSequence(); |
| + void setLongSequence(const Vector<int>&); |
| + |
| + bool isStringArray() const { return m_type == SpecificTypeStringArray; } |
| + const Vector<String>& getAsStringArray(); |
| + void setStringArray(const Vector<String>&); |
| + |
| + bool isUnrestrictedDouble() const { return m_type == SpecificTypeUnrestrictedDouble; } |
| + double getAsUnrestrictedDouble(); |
| + void setUnrestrictedDouble(double); |
| + |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + SpecificTypeLongSequence, |
| + SpecificTypeStringArray, |
| + SpecificTypeUnrestrictedDouble, |
| + }; |
| + SpecificTypes m_type; |
|
haraken
2014/10/30 08:39:26
Nit: SpecificTypes => Types ?
bashi
2014/10/30 12:20:48
'specific type' is a spec-defined term and it woul
|
| + |
| + Vector<int> m_longSequence; |
| + Vector<String> m_stringArray; |
| + double m_unrestrictedDouble; |
| }; |
| +class V8LongSequenceOrStringArrayOrUnrestrictedDouble final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, LongSequenceOrStringArrayOrUnrestrictedDouble&, ExceptionState&); |
| +}; |
| + |
| +v8::Handle<v8::Value> toV8(LongSequenceOrStringArrayOrUnrestrictedDouble&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, LongSequenceOrStringArrayOrUnrestrictedDouble& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| class NodeOrNodeList final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| +public: |
| + NodeOrNodeList(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + bool isNode() const { return m_type == SpecificTypeNode; } |
| + PassRefPtrWillBeRawPtr<Node> getAsNode(); |
| + void setNode(PassRefPtrWillBeRawPtr<Node>); |
| + |
| + bool isNodeList() const { return m_type == SpecificTypeNodeList; } |
| + PassRefPtrWillBeRawPtr<NodeList> getAsNodeList(); |
| + void setNodeList(PassRefPtrWillBeRawPtr<NodeList>); |
| + |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + SpecificTypeNode, |
| + SpecificTypeNodeList, |
| + }; |
| + SpecificTypes m_type; |
| + |
| + RefPtrWillBeMember<Node> m_node; |
| + RefPtrWillBeMember<NodeList> m_nodeList; |
| +}; |
| + |
| +class V8NodeOrNodeList final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, NodeOrNodeList&, ExceptionState&); |
| }; |
| +v8::Handle<v8::Value> toV8(NodeOrNodeList&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, NodeOrNodeList& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| class StringOrDouble final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| +public: |
| + StringOrDouble(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + bool isString() const { return m_type == SpecificTypeString; } |
| + String getAsString(); |
| + void setString(String); |
| + |
| + bool isDouble() const { return m_type == SpecificTypeDouble; } |
| + double getAsDouble(); |
| + void setDouble(double); |
| + |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + SpecificTypeString, |
| + SpecificTypeDouble, |
| + }; |
| + SpecificTypes m_type; |
| + |
| + String m_string; |
| + double m_double; |
| }; |
| +class V8StringOrDouble final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, StringOrDouble&, ExceptionState&); |
| +}; |
| + |
| +v8::Handle<v8::Value> toV8(StringOrDouble&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrDouble& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| class TestInterfaceGarbageCollectedOrString final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| +public: |
| + TestInterfaceGarbageCollectedOrString(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + bool isTestInterfaceGarbageCollected() const { return m_type == SpecificTypeTestInterfaceGarbageCollected; } |
| + RawPtr<TestInterfaceGarbageCollected> getAsTestInterfaceGarbageCollected(); |
| + void setTestInterfaceGarbageCollected(RawPtr<TestInterfaceGarbageCollected>); |
| + |
| + bool isString() const { return m_type == SpecificTypeString; } |
| + String getAsString(); |
| + void setString(String); |
| + |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + SpecificTypeTestInterfaceGarbageCollected, |
| + SpecificTypeString, |
| + }; |
| + SpecificTypes m_type; |
| + |
| + Member<TestInterfaceGarbageCollected> m_testInterfaceGarbageCollected; |
| + String m_string; |
| +}; |
| + |
| +class V8TestInterfaceGarbageCollectedOrString final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, TestInterfaceGarbageCollectedOrString&, ExceptionState&); |
| }; |
| +v8::Handle<v8::Value> toV8(TestInterfaceGarbageCollectedOrString&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollectedOrString& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| class TestInterfaceOrTestInterfaceEmpty final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| +public: |
| + TestInterfaceOrTestInterfaceEmpty(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + bool isTestInterface() const { return m_type == SpecificTypeTestInterface; } |
| + PassRefPtr<TestInterfaceImplementation> getAsTestInterface(); |
| + void setTestInterface(PassRefPtr<TestInterfaceImplementation>); |
| + |
| + bool isTestInterfaceEmpty() const { return m_type == SpecificTypeTestInterfaceEmpty; } |
| + PassRefPtr<TestInterfaceEmpty> getAsTestInterfaceEmpty(); |
| + void setTestInterfaceEmpty(PassRefPtr<TestInterfaceEmpty>); |
| + |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + SpecificTypeTestInterface, |
| + SpecificTypeTestInterfaceEmpty, |
| + }; |
| + SpecificTypes m_type; |
| + |
| + RefPtr<TestInterfaceImplementation> m_testInterface; |
| + RefPtr<TestInterfaceEmpty> m_testInterfaceEmpty; |
| }; |
| +class V8TestInterfaceOrTestInterfaceEmpty final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, TestInterfaceOrTestInterfaceEmpty&, ExceptionState&); |
| +}; |
| + |
| +v8::Handle<v8::Value> toV8(TestInterfaceOrTestInterfaceEmpty&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceOrTestInterfaceEmpty& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| class TestInterfaceWillBeGarbageCollectedOrTestDictionary final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| +public: |
| + TestInterfaceWillBeGarbageCollectedOrTestDictionary(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + bool isTestInterfaceWillBeGarbageCollected() const { return m_type == SpecificTypeTestInterfaceWillBeGarbageCollected; } |
| + PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> getAsTestInterfaceWillBeGarbageCollected(); |
| + void setTestInterfaceWillBeGarbageCollected(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected>); |
| + |
| + bool isTestDictionary() const { return m_type == SpecificTypeTestDictionary; } |
| + TestDictionary getAsTestDictionary(); |
| + void setTestDictionary(TestDictionary); |
| + |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + SpecificTypeTestInterfaceWillBeGarbageCollected, |
| + SpecificTypeTestDictionary, |
| + }; |
| + SpecificTypes m_type; |
| + |
| + RefPtrWillBeMember<TestInterfaceWillBeGarbageCollected> m_testInterfaceWillBeGarbageCollected; |
| + TestDictionary m_testDictionary; |
| +}; |
| + |
| +class V8TestInterfaceWillBeGarbageCollectedOrTestDictionary final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, TestInterfaceWillBeGarbageCollectedOrTestDictionary&, ExceptionState&); |
| }; |
| +v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollectedOrTestDictionary&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollectedOrTestDictionary& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| } // namespace blink |
| #endif // UnionTypeCore_h |