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

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

Issue 611633002: mojom: Add associative arrays to the mojom language. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved test classes to their own shared file. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.h ('k') | mojo/public/cpp/bindings/lib/map_data_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/array_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h
index fd18863f80ceaf8c66023aad0ee4eff121758e63..41532388ac212a531c0a840eb6a544dcf3eb3fa8 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -11,6 +11,7 @@
#include "mojo/public/c/system/macros.h"
#include "mojo/public/cpp/bindings/lib/array_internal.h"
+#include "mojo/public/cpp/bindings/lib/map_serialization.h"
#include "mojo/public/cpp/bindings/lib/string_serialization.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
@@ -29,6 +30,16 @@ inline void SerializeArray_(Array<E> input,
internal::Buffer* buf,
internal::Array_Data<F>** output);
+template <typename ValueValidateParams,
+ typename KeyWrapperType,
+ typename ValueWrapperType,
+ typename KeySerializationType,
+ typename ValueSerializationType>
+inline void SerializeMap_(
+ Map<KeyWrapperType, ValueWrapperType> input,
+ internal::Buffer* buf,
+ internal::Map_Data<KeySerializationType, ValueSerializationType>** output);
+
template <typename E, typename F>
inline void Deserialize_(internal::Array_Data<F>* data, Array<E>* output);
@@ -177,6 +188,15 @@ struct ArraySerializer<S, typename S::Data_*, true> {
SerializeArray_<Params>(input.Pass(), buf, output);
}
};
+
+ template <typename T, typename U, typename Params>
+ struct SerializeCaller<Map<T, U>, Params> {
+ static void Run(Map<T, U> input,
+ Buffer* buf,
+ typename Map<T, U>::Data_** output) {
+ SerializeMap_<Params>(input.Pass(), buf, output);
+ }
+ };
};
template <>
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.h ('k') | mojo/public/cpp/bindings/lib/map_data_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698