| 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 6874fbe5aeda80318f07eca8280157804930823a..b3268720a23eded608f58072a7d62a3e65683763 100644
|
| --- a/mojo/public/cpp/bindings/lib/map_serialization.h
|
| +++ b/mojo/public/cpp/bindings/lib/map_serialization.h
|
| @@ -162,20 +162,27 @@ template <typename MapKey,
|
| typename MapValue,
|
| typename DataKey,
|
| typename DataValue>
|
| -inline void Deserialize_(internal::Map_Data<DataKey, DataValue>* input,
|
| +inline bool Deserialize_(internal::Map_Data<DataKey, DataValue>* input,
|
| Map<MapKey, MapValue>* output,
|
| internal::SerializationContext* context) {
|
| + bool success = true;
|
| if (input) {
|
| Array<MapKey> keys;
|
| Array<MapValue> values;
|
|
|
| - Deserialize_(input->keys.ptr, &keys, context);
|
| - Deserialize_(input->values.ptr, &values, context);
|
| + // Note that we rely on complete deserialization taking place in order to
|
| + // transfer ownership of all encoded handles. Therefore we don't
|
| + // short-circuit on failure here.
|
| + if (!Deserialize_(input->keys.ptr, &keys, context))
|
| + success = false;
|
| + if (!Deserialize_(input->values.ptr, &values, context))
|
| + success = false;
|
|
|
| *output = Map<MapKey, MapValue>(keys.Pass(), values.Pass());
|
| } else {
|
| output->reset();
|
| }
|
| + return success;
|
| }
|
|
|
| } // namespace mojo
|
|
|