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

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

Issue 2112093002: Mojo C++ bindings: Merge EncodePointers/DecodePointers into Serialize/Deserialize, respectively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@61_array_fix
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/map_data_internal.h ('k') | mojo/public/cpp/bindings/lib/native_struct_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/map_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/map_serialization.h b/mojo/public/cpp/bindings/lib/map_serialization.h
index 407c8b4f6c3160ce9ee78baf3d99b5d09f9f5d71..c28b835da6f7cf72e3b57e8dfc8925597e392ab1 100644
--- a/mojo/public/cpp/bindings/lib/map_serialization.h
+++ b/mojo/public/cpp/bindings/lib/map_serialization.h
@@ -122,22 +122,24 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
auto result = Data::New(buf);
if (result) {
- result->keys.ptr =
+ auto keys_ptr =
MojomTypeTraits<Array<Key>>::Data::New(Traits::GetSize(input), buf);
- if (result->keys.ptr) {
+ if (keys_ptr) {
MapKeyReader<MaybeConstUserType> key_reader(input);
KeyArraySerializer::SerializeElements(
- &key_reader, buf, result->keys.ptr,
- validate_params->key_validate_params, context);
+ &key_reader, buf, keys_ptr, validate_params->key_validate_params,
+ context);
+ result->keys.Set(keys_ptr);
}
- result->values.ptr =
+ auto values_ptr =
MojomTypeTraits<Array<Value>>::Data::New(Traits::GetSize(input), buf);
- if (result->values.ptr) {
+ if (values_ptr) {
MapValueReader<MaybeConstUserType> value_reader(input);
ValueArraySerializer::SerializeElements(
- &value_reader, buf, result->values.ptr,
+ &value_reader, buf, values_ptr,
validate_params->element_validate_params, context);
+ result->values.Set(values_ptr);
}
}
*output = result;
@@ -152,9 +154,9 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
std::vector<UserKey> keys;
std::vector<UserValue> values;
- if (!KeyArraySerializer::DeserializeElements(input->keys.ptr, &keys,
+ if (!KeyArraySerializer::DeserializeElements(input->keys.Get(), &keys,
context) ||
- !ValueArraySerializer::DeserializeElements(input->values.ptr, &values,
+ !ValueArraySerializer::DeserializeElements(input->values.Get(), &values,
context)) {
return false;
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/map_data_internal.h ('k') | mojo/public/cpp/bindings/lib/native_struct_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698