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

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

Issue 2358133002: Turn //mojo/public/cpp/bindings and //mojo/public/cpp/system into components (Closed)
Patch Set: Fix wording Created 4 years, 2 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 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/bindings_export.h"
16 #include "mojo/public/cpp/bindings/lib/array_internal.h" 17 #include "mojo/public/cpp/bindings/lib/array_internal.h"
17 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 18 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
18 #include "mojo/public/cpp/bindings/lib/native_struct_data.h" 19 #include "mojo/public/cpp/bindings/lib/native_struct_data.h"
19 #include "mojo/public/cpp/bindings/lib/serialization_forward.h" 20 #include "mojo/public/cpp/bindings/lib/serialization_forward.h"
20 #include "mojo/public/cpp/bindings/lib/serialization_util.h" 21 #include "mojo/public/cpp/bindings/lib/serialization_util.h"
21 #include "mojo/public/cpp/bindings/native_struct.h" 22 #include "mojo/public/cpp/bindings/native_struct.h"
22 #include "mojo/public/cpp/bindings/native_struct_data_view.h" 23 #include "mojo/public/cpp/bindings/native_struct_data_view.h"
23 24
24 namespace mojo { 25 namespace mojo {
25 namespace internal { 26 namespace internal {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return false; 97 return false;
97 } 98 }
98 99
99 // Return the header to its original state. 100 // Return the header to its original state.
100 header->num_bytes += sizeof(ArrayHeader); 101 header->num_bytes += sizeof(ArrayHeader);
101 102
102 return true; 103 return true;
103 } 104 }
104 }; 105 };
105 106
106 struct UnmappedNativeStructSerializerImpl { 107 struct MOJO_CPP_BINDINGS_EXPORT UnmappedNativeStructSerializerImpl {
107 static size_t PrepareToSerialize(const NativeStructPtr& input, 108 static size_t PrepareToSerialize(const NativeStructPtr& input,
108 SerializationContext* context); 109 SerializationContext* context);
109 static void Serialize(const NativeStructPtr& input, 110 static void Serialize(const NativeStructPtr& input,
110 Buffer* buffer, 111 Buffer* buffer,
111 NativeStruct_Data** output, 112 NativeStruct_Data** output,
112 SerializationContext* context); 113 SerializationContext* context);
113 static bool Deserialize(NativeStruct_Data* input, 114 static bool Deserialize(NativeStruct_Data* input,
114 NativeStructPtr* output, 115 NativeStructPtr* output,
115 SerializationContext* context); 116 SerializationContext* context);
116 }; 117 };
117 118
118 template <> 119 template <>
119 struct NativeStructSerializerImpl<NativeStructPtr> 120 struct NativeStructSerializerImpl<NativeStructPtr>
120 : public UnmappedNativeStructSerializerImpl {}; 121 : public UnmappedNativeStructSerializerImpl {};
121 122
122 template <> 123 template <>
123 struct NativeStructSerializerImpl<const NativeStructPtr> 124 struct NativeStructSerializerImpl<const NativeStructPtr>
124 : public UnmappedNativeStructSerializerImpl {}; 125 : public UnmappedNativeStructSerializerImpl {};
125 126
126 template <typename MaybeConstUserType> 127 template <typename MaybeConstUserType>
127 struct Serializer<NativeStructDataView, MaybeConstUserType> 128 struct Serializer<NativeStructDataView, MaybeConstUserType>
128 : public NativeStructSerializerImpl<MaybeConstUserType> {}; 129 : public NativeStructSerializerImpl<MaybeConstUserType> {};
129 130
130 } // namespace internal 131 } // namespace internal
131 } // namespace mojo 132 } // namespace mojo
132 133
133 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_ 134 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_SERIALIZATION_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/native_struct_data.h ('k') | mojo/public/cpp/bindings/lib/router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698