| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ |
| 7 | 7 |
| 8 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 8 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
| 9 #include "mojo/public/cpp/bindings/lib/map_data_internal.h" | 9 #include "mojo/public/cpp/bindings/lib/map_data_internal.h" |
| 10 #include "mojo/public/cpp/bindings/lib/map_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/map_internal.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } else { | 156 } else { |
| 157 *output = nullptr; | 157 *output = nullptr; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 template <typename MapKey, | 161 template <typename MapKey, |
| 162 typename MapValue, | 162 typename MapValue, |
| 163 typename DataKey, | 163 typename DataKey, |
| 164 typename DataValue> | 164 typename DataValue> |
| 165 inline void Deserialize_(internal::Map_Data<DataKey, DataValue>* input, | 165 inline void Deserialize_(internal::Map_Data<DataKey, DataValue>* input, |
| 166 Map<MapKey, MapValue>* output) { | 166 Map<MapKey, MapValue>* output, |
| 167 internal::SerializationContext* context) { |
| 167 if (input) { | 168 if (input) { |
| 168 Array<MapKey> keys; | 169 Array<MapKey> keys; |
| 169 Array<MapValue> values; | 170 Array<MapValue> values; |
| 170 | 171 |
| 171 Deserialize_(input->keys.ptr, &keys); | 172 Deserialize_(input->keys.ptr, &keys, context); |
| 172 Deserialize_(input->values.ptr, &values); | 173 Deserialize_(input->values.ptr, &values, context); |
| 173 | 174 |
| 174 *output = Map<MapKey, MapValue>(keys.Pass(), values.Pass()); | 175 *output = Map<MapKey, MapValue>(keys.Pass(), values.Pass()); |
| 175 } else { | 176 } else { |
| 176 output->reset(); | 177 output->reset(); |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace mojo | 181 } // namespace mojo |
| 181 | 182 |
| 182 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ | 183 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ |
| OLD | NEW |