Index: third_party/WebKit/Source/bindings/core/v8/IDLTypes.h |
diff --git a/third_party/WebKit/Source/bindings/core/v8/IDLTypes.h b/third_party/WebKit/Source/bindings/core/v8/IDLTypes.h |
index ac9546edeb7baa20a32845722af7a32db72d0f3d..1dfff49c57dfa30f77e0fc63b4a3d11e17e40990 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/IDLTypes.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/IDLTypes.h |
@@ -54,7 +54,7 @@ template <typename T> |
struct IDLSequence final : public IDLBase { |
private: |
using CppType = typename NativeValueTraits<T>::ImplType; |
- using MaybeWrappedCppType = |
+ using MaybeMemberCppType = |
typename std::conditional<WTF::IsGarbageCollectedType<CppType>::value, |
Member<CppType>, |
CppType>::type; |
@@ -67,12 +67,42 @@ struct IDLSequence final : public IDLBase { |
// contain Oilpan members. They both also happen to specialize V8TypeOf, |
// which we use to recognize them. |
using ImplType = typename std::conditional< |
- std::is_same<MaybeWrappedCppType, Member<CppType>>::value || |
+ std::is_same<MaybeMemberCppType, Member<CppType>>::value || |
std::is_class<typename V8TypeOf<CppType>::Type>::value, |
- HeapVector<MaybeWrappedCppType>, |
+ HeapVector<MaybeMemberCppType>, |
Vector<CppType>>::type; |
}; |
+// Record |
+template <typename Key, typename Value> |
+struct IDLRecord final : public IDLBase { |
+ static_assert(std::is_same<Key, IDLByteString>::value || |
+ std::is_same<Key, IDLString>::value || |
+ std::is_same<Key, IDLUSVString>::value, |
+ "IDLRecord keys must be of a WebIDL string type"); |
+ |
+ private: |
+ // Record keys are always strings, so we do not need to introspect them. |
+ using ValueCppType = typename NativeValueTraits<Value>::ImplType; |
+ using MaybeMemberValueCppType = typename std::conditional< |
+ WTF::IsGarbageCollectedType<ValueCppType>::value, |
+ Member<ValueCppType>, |
+ ValueCppType>::type; |
+ |
+ public: |
+ // Two kinds of types need HeapVector: |
+ // 1. Oilpan types, which are wrapped by Member<>. |
+ // 2. IDL unions and dictionaries, which are not Oilpan types themselves (and |
+ // are thus not wrapped by Member<>) but have a trace() method and can |
+ // contain Oilpan members. They both also happen to specialize V8TypeOf, |
+ // which we use to recognize them. |
+ using ImplType = typename std::conditional< |
+ std::is_same<MaybeMemberValueCppType, Member<ValueCppType>>::value || |
+ std::is_class<typename V8TypeOf<ValueCppType>::Type>::value, |
+ HeapVector<std::pair<String, MaybeMemberValueCppType>>, |
+ Vector<std::pair<String, ValueCppType>>>::type; |
+}; |
+ |
} // namespace blink |
#endif // IDLTypes_h |