| Index: mojo/public/cpp/bindings/lib/array_internal.h
|
| diff --git a/mojo/public/cpp/bindings/lib/array_internal.h b/mojo/public/cpp/bindings/lib/array_internal.h
|
| index ded07b9e1c3939a3a36574a9f75abd77c48a7a8e..eb25e35210a5d49cc5d41ff2caab9664db479630 100644
|
| --- a/mojo/public/cpp/bindings/lib/array_internal.h
|
| +++ b/mojo/public/cpp/bindings/lib/array_internal.h
|
| @@ -13,7 +13,9 @@
|
| #include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
|
| #include "mojo/public/cpp/bindings/lib/bounds_checker.h"
|
| #include "mojo/public/cpp/bindings/lib/buffer.h"
|
| +#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
|
| #include "mojo/public/cpp/bindings/lib/template_util.h"
|
| +#include "mojo/public/cpp/bindings/lib/validate_params.h"
|
| #include "mojo/public/cpp/bindings/lib/validation_errors.h"
|
| #include "mojo/public/cpp/environment/logging.h"
|
|
|
| @@ -141,26 +143,6 @@ struct ArrayDataTraits<bool> {
|
| }
|
| };
|
|
|
| -// Array type information needed for valdiation.
|
| -template <uint32_t in_expected_num_elements,
|
| - bool in_element_is_nullable,
|
| - typename InElementValidateParams>
|
| -class ArrayValidateParams {
|
| - public:
|
| - // Validation information for elements. It is either another specialization of
|
| - // ArrayValidateParams (if elements are arrays) or NoValidateParams.
|
| - typedef InElementValidateParams ElementValidateParams;
|
| -
|
| - // If |expected_num_elements| is not 0, the array is expected to have exactly
|
| - // that number of elements.
|
| - static const uint32_t expected_num_elements = in_expected_num_elements;
|
| - // Whether the elements are nullable.
|
| - static const bool element_is_nullable = in_element_is_nullable;
|
| -};
|
| -
|
| -// NoValidateParams is used to indicate the end of an ArrayValidateParams chain.
|
| -class NoValidateParams {};
|
| -
|
| // What follows is code to support the serialization of Array_Data<T>. There
|
| // are two interesting cases: arrays of primitives and arrays of objects.
|
| // Arrays of objects are represented as arrays of pointers to objects.
|
| @@ -313,6 +295,14 @@ struct ArraySerializationHelper<P*, false> {
|
| }
|
| };
|
|
|
| + template <typename Key, typename Value, typename Params>
|
| + struct ValidateCaller<Map_Data<Key, Value>, Params> {
|
| + static bool Run(const void* data, BoundsChecker* bounds_checker) {
|
| + return Map_Data<Key, Value>::template Validate<Params>(data,
|
| + bounds_checker);
|
| + }
|
| + };
|
| +
|
| template <typename T, typename Params>
|
| struct ValidateCaller<Array_Data<T>, Params> {
|
| static bool Run(const void* data, BoundsChecker* bounds_checker) {
|
| @@ -416,7 +406,7 @@ class Array_Data {
|
| header_.num_bytes = num_bytes;
|
| header_.num_elements = num_elements;
|
| }
|
| - ~Array_Data() {}
|
| + ~Array_Data() = delete;
|
|
|
| internal::ArrayHeader header_;
|
|
|
|
|