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

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

Issue 2034273002: Mojo C++ bindings: introduce mojo::WTFMap for blink bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed the code of adding enum key support to WTF::HashMap; which turned out to be non-trivial; wi… Created 4 years, 6 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
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/lib/map_serialization.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ARRAY_SERIALIZATION_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> // For |memcpy()|. 9 #include <string.h> // For |memcpy()|.
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 typename MaybeConstUserType, 157 typename MaybeConstUserType,
158 typename UserTypeReader> 158 typename UserTypeReader>
159 struct ArraySerializer<MojomType, 159 struct ArraySerializer<MojomType,
160 MaybeConstUserType, 160 MaybeConstUserType,
161 UserTypeReader, 161 UserTypeReader,
162 ArraySerializerType::BOOLEAN> { 162 ArraySerializerType::BOOLEAN> {
163 using UserType = typename std::remove_const<MaybeConstUserType>::type; 163 using UserType = typename std::remove_const<MaybeConstUserType>::type;
164 using Traits = ArrayTraits<UserType>; 164 using Traits = ArrayTraits<UserType>;
165 using Data = typename MojomType::Data_; 165 using Data = typename MojomType::Data_;
166 166
167 static_assert(std::is_same<bool, typename UserType::Element>::value, 167 static_assert(std::is_same<bool, typename Traits::Element>::value,
168 "Incorrect array serializer"); 168 "Incorrect array serializer");
169 169
170 static size_t GetSerializedSize(UserTypeReader* input, 170 static size_t GetSerializedSize(UserTypeReader* input,
171 SerializationContext* context) { 171 SerializationContext* context) {
172 return sizeof(Data) + Align((input->GetSize() + 7) / 8); 172 return sizeof(Data) + Align((input->GetSize() + 7) / 8);
173 } 173 }
174 174
175 static void SerializeElements(UserTypeReader* input, 175 static void SerializeElements(UserTypeReader* input,
176 Buffer* buf, 176 Buffer* buf,
177 Data* output, 177 Data* output,
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 if (!input) 457 if (!input)
458 return CallSetToNullIfExists<Traits>(output); 458 return CallSetToNullIfExists<Traits>(output);
459 return Impl::DeserializeElements(input, output, context); 459 return Impl::DeserializeElements(input, output, context);
460 } 460 }
461 }; 461 };
462 462
463 } // namespace internal 463 } // namespace internal
464 } // namespace mojo 464 } // namespace mojo
465 465
466 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ 466 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/lib/map_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698