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

Unified Diff: mojo/public/cpp/bindings/lib/native_struct_serialization.h

Issue 1953493002: Mojo C++ bindings: custom type mapping for array - part 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@21_simplify
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/native_struct_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/native_struct_serialization.h b/mojo/public/cpp/bindings/lib/native_struct_serialization.h
index 7071ee1863ebae878a4802cfb4e82101e0407851..90927a9e720f47f2dec3c5c61944301b050fd883 100644
--- a/mojo/public/cpp/bindings/lib/native_struct_serialization.h
+++ b/mojo/public/cpp/bindings/lib/native_struct_serialization.h
@@ -22,14 +22,6 @@
namespace mojo {
namespace internal {
-// Generated bindings for native-only types will specialize this to |true|.
-// It can be used as a signal (by e.g. the Array serializer) for when to use
-// SerializeNative_ with a type.
-template <typename E>
-struct ShouldUseNativeSerializer {
- static const bool value = false;
-};
-
template <typename MaybeConstUserType,
bool unmapped = std::is_same<
NativeStructPtr,
@@ -42,7 +34,7 @@ struct NativeStructSerializerImpl<MaybeConstUserType, true> {
SerializationContext* context) {
if (!input)
return 0;
- return GetSerializedSize_(input->data, context);
+ return internal::PrepareToSerialize<Array<uint8_t>>(input->data, context);
}
static void Serialize(NativeStructPtr& input,
@@ -56,7 +48,8 @@ struct NativeStructSerializerImpl<MaybeConstUserType, true> {
Array_Data<uint8_t>* data = nullptr;
const ArrayValidateParams params(0, false, nullptr);
- SerializeArray_(std::move(input->data), buffer, &data, &params, context);
+ internal::Serialize<Array<uint8_t>>(input->data, buffer, &data, &params,
+ context);
*output = reinterpret_cast<NativeStruct_Data*>(data);
}
@@ -66,7 +59,7 @@ struct NativeStructSerializerImpl<MaybeConstUserType, true> {
Array_Data<uint8_t>* data = reinterpret_cast<Array_Data<uint8_t>*>(input);
NativeStructPtr result(NativeStruct::New());
- if (!Deserialize_(data, &result->data, context)) {
+ if (!internal::Deserialize<Array<uint8_t>>(data, &result->data, context)) {
output = nullptr;
return false;
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/map_serialization.h ('k') | mojo/public/cpp/bindings/lib/serialization_forward.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698