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

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

Issue 2259283003: Mojo C++ bindings: share DataView class between chromium and blink variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@92_change_traits_param
Patch Set: . Created 4 years, 4 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/map_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/map_serialization.h b/mojo/public/cpp/bindings/lib/map_serialization.h
index 88276e1b3c4b1e5da1749f2e26b46537cf7f253c..718a76307db88c6050b3b766b001081e9d05cd39 100644
--- a/mojo/public/cpp/bindings/lib/map_serialization.h
+++ b/mojo/public/cpp/bindings/lib/map_serialization.h
@@ -8,11 +8,11 @@
#include <type_traits>
#include <vector>
-#include "mojo/public/cpp/bindings/array.h"
+#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/lib/array_serialization.h"
#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization_forward.h"
-#include "mojo/public/cpp/bindings/map.h"
+#include "mojo/public/cpp/bindings/map_data_view.h"
namespace mojo {
namespace internal {
@@ -81,17 +81,17 @@ class MapValueReader : public MapReaderBase<MaybeConstUserType> {
};
template <typename Key, typename Value, typename MaybeConstUserType>
-struct Serializer<Map<Key, Value>, MaybeConstUserType> {
+struct Serializer<MapDataView<Key, Value>, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = MapTraits<UserType>;
using UserKey = typename Traits::Key;
using UserValue = typename Traits::Value;
- using Data = typename MojomTypeTraits<Map<Key, Value>>::Data;
- using KeyArraySerializer = ArraySerializer<Array<Key>,
+ using Data = typename MojomTypeTraits<MapDataView<Key, Value>>::Data;
+ using KeyArraySerializer = ArraySerializer<ArrayDataView<Key>,
std::vector<UserKey>,
MapKeyReader<MaybeConstUserType>>;
using ValueArraySerializer =
- ArraySerializer<Array<Value>,
+ ArraySerializer<ArrayDataView<Value>,
std::vector<UserValue>,
MapValueReader<MaybeConstUserType>>;
@@ -125,8 +125,8 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
auto result = Data::New(buf);
if (result) {
- auto keys_ptr =
- MojomTypeTraits<Array<Key>>::Data::New(Traits::GetSize(input), buf);
+ auto keys_ptr = MojomTypeTraits<ArrayDataView<Key>>::Data::New(
+ Traits::GetSize(input), buf);
if (keys_ptr) {
MapKeyReader<MaybeConstUserType> key_reader(input);
KeyArraySerializer::SerializeElements(
@@ -135,8 +135,8 @@ struct Serializer<Map<Key, Value>, MaybeConstUserType> {
result->keys.Set(keys_ptr);
}
- auto values_ptr =
- MojomTypeTraits<Array<Value>>::Data::New(Traits::GetSize(input), buf);
+ auto values_ptr = MojomTypeTraits<ArrayDataView<Value>>::Data::New(
+ Traits::GetSize(input), buf);
if (values_ptr) {
MapValueReader<MaybeConstUserType> value_reader(input);
ValueArraySerializer::SerializeElements(

Powered by Google App Engine
This is Rietveld 408576698