| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NATIVE_STRUCT_SERIALIZATION_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <limits> | 11 #include <limits> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/pickle.h" | 14 #include "base/pickle.h" |
| 15 #include "ipc/ipc_param_traits.h" | 15 #include "ipc/ipc_param_traits.h" |
| 16 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 16 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
| 17 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 17 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| 18 #include "mojo/public/cpp/bindings/lib/native_struct_data.h" | 18 #include "mojo/public/cpp/bindings/lib/native_struct_data.h" |
| 19 #include "mojo/public/cpp/bindings/lib/serialization_forward.h" | 19 #include "mojo/public/cpp/bindings/lib/serialization_forward.h" |
| 20 #include "mojo/public/cpp/bindings/lib/serialization_util.h" | 20 #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| 21 #include "mojo/public/cpp/bindings/native_struct.h" | 21 #include "mojo/public/cpp/bindings/native_struct.h" |
| 22 #include "mojo/public/cpp/bindings/native_struct_data_view.h" |
| 22 | 23 |
| 23 namespace mojo { | 24 namespace mojo { |
| 24 namespace internal { | 25 namespace internal { |
| 25 | 26 |
| 26 template <typename MaybeConstUserType> | 27 template <typename MaybeConstUserType> |
| 27 struct NativeStructSerializerImpl { | 28 struct NativeStructSerializerImpl { |
| 28 using UserType = typename std::remove_const<MaybeConstUserType>::type; | 29 using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| 29 using Traits = IPC::ParamTraits<UserType>; | 30 using Traits = IPC::ParamTraits<UserType>; |
| 30 | 31 |
| 31 static size_t PrepareToSerialize(MaybeConstUserType& value, | 32 static size_t PrepareToSerialize(MaybeConstUserType& value, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 template <> | 118 template <> |
| 118 struct NativeStructSerializerImpl<NativeStructPtr> | 119 struct NativeStructSerializerImpl<NativeStructPtr> |
| 119 : public UnmappedNativeStructSerializerImpl {}; | 120 : public UnmappedNativeStructSerializerImpl {}; |
| 120 | 121 |
| 121 template <> | 122 template <> |
| 122 struct NativeStructSerializerImpl<const NativeStructPtr> | 123 struct NativeStructSerializerImpl<const NativeStructPtr> |
| 123 : public UnmappedNativeStructSerializerImpl {}; | 124 : public UnmappedNativeStructSerializerImpl {}; |
| 124 | 125 |
| 125 template <typename MaybeConstUserType> | 126 template <typename MaybeConstUserType> |
| 126 struct Serializer<NativeStructPtr, MaybeConstUserType> | 127 struct Serializer<NativeStructDataView, MaybeConstUserType> |
| 127 : public NativeStructSerializerImpl<MaybeConstUserType> {}; | 128 : public NativeStructSerializerImpl<MaybeConstUserType> {}; |
| 128 | 129 |
| 129 } // namespace internal | 130 } // namespace internal |
| 130 } // namespace mojo | 131 } // namespace mojo |
| 131 | 132 |
| 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_ | 133 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_ |
| OLD | NEW |