| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DictionaryTest_h | 5 #ifndef DictionaryTest_h |
| 6 #define DictionaryTest_h | 6 #define DictionaryTest_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/Nullable.h" | 8 #include "bindings/core/v8/Nullable.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "core/dom/Element.h" | 11 #include "core/dom/Element.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class InternalDictionary; | 17 class InternalDictionary; |
| 18 class InternalDictionaryDerived; |
| 18 | 19 |
| 19 class DictionaryTest : public GarbageCollectedFinalized<DictionaryTest>, public
ScriptWrappable { | 20 class DictionaryTest : public GarbageCollectedFinalized<DictionaryTest>, public
ScriptWrappable { |
| 20 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
| 21 public: | 22 public: |
| 22 static DictionaryTest* create() | 23 static DictionaryTest* create() |
| 23 { | 24 { |
| 24 return new DictionaryTest(); | 25 return new DictionaryTest(); |
| 25 } | 26 } |
| 26 virtual ~DictionaryTest(); | 27 virtual ~DictionaryTest(); |
| 27 | 28 |
| 28 // Stores all members into corresponding fields | 29 // Stores all members into corresponding fields |
| 29 void set(const InternalDictionary&); | 30 void set(const InternalDictionary&); |
| 30 // Sets each member of the given TestDictionary from fields | 31 // Sets each member of the given TestDictionary from fields |
| 31 void get(InternalDictionary&); | 32 void get(InternalDictionary&); |
| 32 | 33 |
| 34 void setDerived(const InternalDictionaryDerived&); |
| 35 void getDerived(InternalDictionaryDerived&); |
| 36 |
| 33 void trace(Visitor*); | 37 void trace(Visitor*); |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 DictionaryTest(); | 40 DictionaryTest(); |
| 37 | 41 |
| 38 void reset(); | 42 void reset(); |
| 39 | 43 |
| 40 // The reason to use Nullable<T> is convenience; we use Nullable<T> here to | 44 // The reason to use Nullable<T> is convenience; we use Nullable<T> here to |
| 41 // record whether the member field is set or not. Some members are not | 45 // record whether the member field is set or not. Some members are not |
| 42 // wrapped with Nullable because: | 46 // wrapped with Nullable because: |
| 43 // - |longMemberWithDefault| has a non-null default value | 47 // - |longMemberWithDefault| has a non-null default value |
| 44 // - String and PtrTypes can express whether they are null | 48 // - String and PtrTypes can express whether they are null |
| 45 Nullable<int> m_longMember; | 49 Nullable<int> m_longMember; |
| 46 int m_longMemberWithDefault; | 50 int m_longMemberWithDefault; |
| 47 Nullable<int> m_longOrNullMember; | 51 Nullable<int> m_longOrNullMember; |
| 48 Nullable<int> m_longOrNullMemberWithDefault; | 52 Nullable<int> m_longOrNullMemberWithDefault; |
| 49 Nullable<bool> m_booleanMember; | 53 Nullable<bool> m_booleanMember; |
| 50 Nullable<double> m_doubleMember; | 54 Nullable<double> m_doubleMember; |
| 51 String m_stringMember; | 55 String m_stringMember; |
| 52 String m_stringMemberWithDefault; | 56 String m_stringMemberWithDefault; |
| 53 Nullable<Vector<String> > m_stringSequenceMember; | 57 Nullable<Vector<String> > m_stringSequenceMember; |
| 54 Nullable<Vector<String> > m_stringSequenceOrNullMember; | 58 Nullable<Vector<String> > m_stringSequenceOrNullMember; |
| 55 String m_enumMember; | 59 String m_enumMember; |
| 56 String m_enumMemberWithDefault; | 60 String m_enumMemberWithDefault; |
| 57 String m_enumOrNullMember; | 61 String m_enumOrNullMember; |
| 58 RefPtrWillBeMember<Element> m_elementMember; | 62 RefPtrWillBeMember<Element> m_elementMember; |
| 59 RefPtrWillBeMember<Element> m_elementOrNullMember; | 63 RefPtrWillBeMember<Element> m_elementOrNullMember; |
| 60 ScriptValue m_objectMember; | 64 ScriptValue m_objectMember; |
| 61 ScriptValue m_objectOrNullMemberWithDefault; | 65 ScriptValue m_objectOrNullMemberWithDefault; |
| 66 String m_derivedStringMember; |
| 67 String m_derivedStringMemberWithDefault; |
| 62 }; | 68 }; |
| 63 | 69 |
| 64 } // namespace blink | 70 } // namespace blink |
| 65 | 71 |
| 66 #endif // DictionaryTest_h | 72 #endif // DictionaryTest_h |
| OLD | NEW |