| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <string.h> // For |memcpy()|. | 9 #include <string.h> // For |memcpy()|. |
| 10 | 10 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 Impl::SerializeElements(input, buf, result, validate_params, context); | 383 Impl::SerializeElements(input, buf, result, validate_params, context); |
| 384 *output = result; | 384 *output = result; |
| 385 } else { | 385 } else { |
| 386 *output = nullptr; | 386 *output = nullptr; |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 static bool Deserialize(Data* input, | 390 static bool Deserialize(Data* input, |
| 391 UserType* output, | 391 UserType* output, |
| 392 SerializationContext* context) { | 392 SerializationContext* context) { |
| 393 if (input) | 393 if (!input) |
| 394 return Impl::DeserializeElements(input, output, context); | 394 return CallSetToNullIfExists<Traits>(output); |
| 395 Traits::SetToNull(*output); | 395 return Impl::DeserializeElements(input, output, context); |
| 396 return true; | |
| 397 } | 396 } |
| 398 }; | 397 }; |
| 399 | 398 |
| 400 } // namespace internal | 399 } // namespace internal |
| 401 } // namespace mojo | 400 } // namespace mojo |
| 402 | 401 |
| 403 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ | 402 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
| OLD | NEW |