OLD | NEW |
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 // TODO(vardhan): Currently, the logic for serializing a mojom type exists in | 5 // TODO(vardhan): Currently, the logic for serializing a mojom type exists in |
6 // two places: the C++ code generator template, and here. However, most types | 6 // two places: the C++ code generator template, and here. However, most types |
7 // are serialized the same way within Arrays or outside, with the exception of | 7 // are serialized the same way within Arrays or outside, with the exception of |
8 // |bool|. Consider defining serialization/deserialization traits for each | 8 // |bool|. Consider defining serialization/deserialization traits for each |
9 // serializable type and call those traits from here. This should help us | 9 // serializable type and call those traits from here. This should help us |
10 // remove most of the ArraySerializer<> specializations here. | 10 // remove most of the ArraySerializer<> specializations here. |
11 | 11 |
12 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ | 12 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
13 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ | 13 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
14 | 14 |
15 #include <string.h> // For |memcpy()|. | 15 #include <string.h> // For |memcpy()|. |
16 #include <type_traits> | 16 #include <type_traits> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "mojo/public/c/system/macros.h" | |
20 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 19 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
21 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 20 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
22 #include "mojo/public/cpp/bindings/lib/iterator_util.h" | 21 #include "mojo/public/cpp/bindings/lib/iterator_util.h" |
23 #include "mojo/public/cpp/bindings/lib/map_data_internal.h" | 22 #include "mojo/public/cpp/bindings/lib/map_data_internal.h" |
24 #include "mojo/public/cpp/bindings/lib/map_serialization_forward.h" | 23 #include "mojo/public/cpp/bindings/lib/map_serialization_forward.h" |
25 #include "mojo/public/cpp/bindings/lib/string_serialization.h" | 24 #include "mojo/public/cpp/bindings/lib/string_serialization.h" |
26 #include "mojo/public/cpp/bindings/lib/validation_errors.h" | 25 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
27 | 26 |
28 namespace mojo { | 27 namespace mojo { |
29 | 28 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 if (input) { | 529 if (input) { |
531 internal::ArraySerializer<E, F>::DeserializeElements(input, output); | 530 internal::ArraySerializer<E, F>::DeserializeElements(input, output); |
532 } else { | 531 } else { |
533 output->reset(); | 532 output->reset(); |
534 } | 533 } |
535 } | 534 } |
536 | 535 |
537 } // namespace mojo | 536 } // namespace mojo |
538 | 537 |
539 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ | 538 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ |
OLD | NEW |