| Index: mojo/public/cpp/bindings/lib/map_serialization.h
|
| diff --git a/mojo/public/cpp/bindings/lib/map_serialization.h b/mojo/public/cpp/bindings/lib/map_serialization.h
|
| index 5df94cd7f230bf229bba7e2a639d7f748b297be8..7bf61a8984bc8b74af93964b3ee1cc727c2100ea 100644
|
| --- a/mojo/public/cpp/bindings/lib/map_serialization.h
|
| +++ b/mojo/public/cpp/bindings/lib/map_serialization.h
|
| @@ -6,6 +6,7 @@
|
| #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
|
|
|
| #include <type_traits>
|
| +#include <vector>
|
|
|
| #include "mojo/public/cpp/bindings/array.h"
|
| #include "mojo/public/cpp/bindings/lib/array_serialization.h"
|
| @@ -84,11 +85,11 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
|
| using UserValue = typename Traits::Value;
|
| using Data = typename Map<Key, Value>::Data_;
|
| using KeyArraySerializer = ArraySerializer<Array<Key>,
|
| - Array<UserKey>,
|
| + std::vector<UserKey>,
|
| MapKeyReader<MaybeConstUserType>>;
|
| using ValueArraySerializer =
|
| ArraySerializer<Array<Value>,
|
| - Array<UserValue>,
|
| + std::vector<UserValue>,
|
| MapValueReader<MaybeConstUserType>>;
|
|
|
| static size_t PrepareToSerialize(MaybeConstUserType& input,
|
| @@ -147,8 +148,8 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
|
| if (!input)
|
| return CallSetToNullIfExists<Traits>(output);
|
|
|
| - Array<UserKey> keys;
|
| - Array<UserValue> values;
|
| + std::vector<UserKey> keys;
|
| + std::vector<UserValue> values;
|
|
|
| if (!KeyArraySerializer::DeserializeElements(input->keys.ptr, &keys,
|
| context) ||
|
| @@ -161,8 +162,10 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
|
| size_t size = keys.size();
|
| Traits::SetToEmpty(output);
|
|
|
| - for (size_t i = 0; i < size; ++i)
|
| - Traits::Insert(*output, std::move(keys[i]), std::move(values[i]));
|
| + for (size_t i = 0; i < size; ++i) {
|
| + if (!Traits::Insert(*output, std::move(keys[i]), std::move(values[i])))
|
| + return false;
|
| + }
|
| return true;
|
| }
|
| };
|
|
|