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

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

Issue 1953493002: Mojo C++ bindings: custom type mapping for array - part 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@21_simplify
Patch Set: Created 4 years, 7 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/serialization_forward.h
diff --git a/mojo/public/cpp/bindings/lib/serialization_forward.h b/mojo/public/cpp/bindings/lib/serialization_forward.h
index cb81351e5eca7ed50a807c10238ff0873883cbf1..657a7a3524f5f006d452912e26ec8dcdd107b091 100644
--- a/mojo/public/cpp/bindings/lib/serialization_forward.h
+++ b/mojo/public/cpp/bindings/lib/serialization_forward.h
@@ -7,10 +7,8 @@
#include <stddef.h>
-#include "mojo/public/cpp/bindings/array.h"
#include "mojo/public/cpp/bindings/array_traits.h"
#include "mojo/public/cpp/bindings/lib/wtf_string_serialization.h"
-#include "mojo/public/cpp/bindings/map.h"
#include "mojo/public/cpp/bindings/native_struct.h"
#include "mojo/public/cpp/bindings/string_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
@@ -21,32 +19,21 @@
// wtf_serialization.h if necessary).
namespace mojo {
-
-template <typename T>
-class WTFArray;
-
namespace internal {
-template <typename T>
-class Array_Data;
-
-class ArrayValidateParams;
-
class Buffer;
-template <typename K, typename V>
-class Map_Data;
-
class NativeStruct_Data;
struct SerializationContext;
-template <typename T>
-struct ShouldUseNativeSerializer;
-
template <typename MojomType, typename MaybeConstUserType>
struct Serializer;
+// PrepareToSerialize() must be matched by a Serialize() for the same input
+// later. Moreover, within the same SerializationContext if PrepareToSerialize()
+// is called for |input_1|, ..., |input_n|, Serialize() must be called for
+// those objects in the exact same order.
template <typename MojomType, typename InputUserType, typename... Args>
size_t PrepareToSerialize(InputUserType&& input, Args&&... args) {
return Serializer<MojomType,
@@ -92,72 +79,6 @@ bool Deserialize_(internal::NativeStruct_Data* input,
internal::SerializationContext* context);
// -----------------------------------------------------------------------------
-// Forward declaration for Array.
-
-template <typename E>
-inline size_t GetSerializedSize_(const Array<E>& input,
- internal::SerializationContext* context);
-
-template <typename E>
-inline void SerializeArray_(
- Array<E> input,
- internal::Buffer* buf,
- typename Array<E>::Data_** output,
- const internal::ArrayValidateParams* validate_params,
- internal::SerializationContext* context);
-
-template <typename E>
-inline bool Deserialize_(typename Array<E>::Data_* input,
- Array<E>* output,
- internal::SerializationContext* context);
-
-// -----------------------------------------------------------------------------
-// Forward declaration for WTFArray.
-
-template <typename E>
-inline size_t GetSerializedSize_(const WTFArray<E>& input,
- internal::SerializationContext* context);
-
-template <typename E>
-inline void SerializeArray_(
- WTFArray<E> input,
- internal::Buffer* buf,
- typename WTFArray<E>::Data_** output,
- const internal::ArrayValidateParams* validate_params,
- internal::SerializationContext* context);
-
-template <typename E>
-inline bool Deserialize_(typename WTFArray<E>::Data_* input,
- WTFArray<E>* output,
- internal::SerializationContext* context);
-
-// -----------------------------------------------------------------------------
-// Forward declaration for Map.
-
-template <typename MapKey, typename MapValue>
-inline size_t GetSerializedSize_(const Map<MapKey, MapValue>& input,
- internal::SerializationContext* context);
-
-template <typename MapKey,
- typename MapValue,
- typename DataKey,
- typename DataValue>
-inline void SerializeMap_(
- Map<MapKey, MapValue> input,
- internal::Buffer* buf,
- internal::Map_Data<DataKey, DataValue>** output,
- const internal::ArrayValidateParams* value_validate_params,
- internal::SerializationContext* context);
-
-template <typename MapKey,
- typename MapValue,
- typename DataKey,
- typename DataValue>
-inline bool Deserialize_(internal::Map_Data<DataKey, DataValue>* input,
- Map<MapKey, MapValue>* output,
- internal::SerializationContext* context);
-
-// -----------------------------------------------------------------------------
// Forward declaration for String.
size_t GetSerializedSize_(const String& input,
« no previous file with comments | « mojo/public/cpp/bindings/lib/native_struct_serialization.h ('k') | mojo/public/cpp/bindings/lib/serialization_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698