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_STRING_SERIALIZATION_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 CallWithContext(Traits::GetSize, input, custom_context)); | 51 CallWithContext(Traits::GetSize, input, custom_context)); |
52 } | 52 } |
53 *output = result; | 53 *output = result; |
54 | 54 |
55 CustomContextHelper<Traits>::TearDown(input, custom_context); | 55 CustomContextHelper<Traits>::TearDown(input, custom_context); |
56 } | 56 } |
57 | 57 |
58 static bool Deserialize(String_Data* input, | 58 static bool Deserialize(String_Data* input, |
59 UserType* output, | 59 UserType* output, |
60 SerializationContext* context) { | 60 SerializationContext* context) { |
| 61 if (!input) |
| 62 return CallSetToNullIfExists<Traits>(output); |
61 return Traits::Read(StringDataView(input), output); | 63 return Traits::Read(StringDataView(input), output); |
62 } | 64 } |
63 }; | 65 }; |
64 | 66 |
65 } // namespace internal | 67 } // namespace internal |
66 } // namespace mojo | 68 } // namespace mojo |
67 | 69 |
68 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ | 70 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ |
OLD | NEW |