Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: mojo/public/cpp/bindings/lib/string_serialization.h

Issue 1966933002: Mojo C++ bindings: switch the existing usage of StructTraits to use the new data view interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26_reader
Patch Set: typeid() is not allowed :/ Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698