| 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_ARRAY_SERIALIZATION_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
| 7 | 7 |
| 8 #include <string.h> // For |memcpy()|. | 8 #include <string.h> // For |memcpy()|. |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 internal::Array_Data<F>* result = | 237 internal::Array_Data<F>* result = |
| 238 internal::Array_Data<F>::New(input.size(), buf); | 238 internal::Array_Data<F>::New(input.size(), buf); |
| 239 if (result) { | 239 if (result) { |
| 240 internal::ArraySerializer<E, F>::template SerializeElements< | 240 internal::ArraySerializer<E, F>::template SerializeElements< |
| 241 ValidateParams::element_is_nullable, | 241 ValidateParams::element_is_nullable, |
| 242 typename ValidateParams::ElementValidateParams>( | 242 typename ValidateParams::ElementValidateParams>( |
| 243 internal::Forward(input), buf, result); | 243 internal::Forward(input), buf, result); |
| 244 } | 244 } |
| 245 *output = result; | 245 *output = result; |
| 246 } else { | 246 } else { |
| 247 *output = NULL; | 247 *output = nullptr; |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 template <typename E, typename F> | 251 template <typename E, typename F> |
| 252 inline void Deserialize_(internal::Array_Data<F>* input, Array<E>* output) { | 252 inline void Deserialize_(internal::Array_Data<F>* input, Array<E>* output) { |
| 253 if (input) { | 253 if (input) { |
| 254 internal::ArraySerializer<E, F>::DeserializeElements(input, output); | 254 internal::ArraySerializer<E, F>::DeserializeElements(input, output); |
| 255 } else { | 255 } else { |
| 256 output->reset(); | 256 output->reset(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace mojo | 260 } // namespace mojo |
| 261 | 261 |
| 262 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ | 262 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
| OLD | NEW |