| Index: mojo/public/cpp/bindings/wtf_array.h
|
| diff --git a/mojo/public/cpp/bindings/wtf_array.h b/mojo/public/cpp/bindings/wtf_array.h
|
| index b5d1a30c36304ace290d60d6735919ec408083fd..becc0671b4ba9cacf7b098b9aa888be367c7e36e 100644
|
| --- a/mojo/public/cpp/bindings/wtf_array.h
|
| +++ b/mojo/public/cpp/bindings/wtf_array.h
|
| @@ -230,6 +230,19 @@ class WTFArray {
|
| bool is_null_;
|
| };
|
|
|
| +// A |TypeConverter| that will create a |WTFArray<T>| containing a copy of the
|
| +// contents of a |WTF::Vector<E, c, A>|, using |TypeConverter<T, E>| to copy
|
| +// each element. The returned array will always be non-null.
|
| +template <typename T, typename E, size_t c, typename A>
|
| +struct TypeConverter<WTFArray<T>, WTF::Vector<E, c, A>> {
|
| + static WTFArray<T> Convert(const WTF::Vector<E, c, A>& input) {
|
| + WTFArray<T> result(input.size());
|
| + for (size_t i = 0; i < input.size(); ++i)
|
| + result[i] = TypeConverter<T, E>::Convert(input[i]);
|
| + return std::move(result);
|
| + }
|
| +};
|
| +
|
| } // namespace mojo
|
|
|
| #endif // MOJO_PUBLIC_CPP_BINDINGS_WTF_ARRAY_H_
|
|
|