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 611a0c04b81aee15c442a22bea42ee60886d21ec..aaee31728f80e45b42d7443942290fe3967ec0e4 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/IDLTypes.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/IDLTypes.h |
@@ -75,6 +75,36 @@ struct CORE_EXPORT IDLSequence final : public IDLBase { |
Vector<CppType>>::type; |
}; |
+// Record |
+template <typename Key, typename Value> |
+struct CORE_EXPORT 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 MaybeWrappedValueCppType = 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<MaybeWrappedValueCppType, Member<ValueCppType>>::value || |
+ std::is_class<typename V8TypeOf<ValueCppType>::Type>::value, |
+ HeapVector<std::pair<String, MaybeWrappedValueCppType>>, |
+ Vector<std::pair<String, ValueCppType>>>::type; |
+}; |
+ |
} // namespace blink |
#endif // IDLTypes_h |