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

Side by Side Diff: mojo/public/cpp/bindings/lib/validation_util.h

Issue 2030873002: Mojo C++ bindings: rename ArrayValidateParams for clarity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-enums
Patch Set: Rebase Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 bool ValidateHandleNonNullable(const Handle_Data& input, 85 bool ValidateHandleNonNullable(const Handle_Data& input,
86 const char* error_message); 86 const char* error_message);
87 87
88 bool ValidateInterfaceIdNonNullable(InterfaceId input, 88 bool ValidateInterfaceIdNonNullable(InterfaceId input,
89 const char* error_message); 89 const char* error_message);
90 90
91 template <typename T> 91 template <typename T>
92 bool ValidateArray(const Pointer<Array_Data<T>>& input, 92 bool ValidateArray(const Pointer<Array_Data<T>>& input,
93 BoundsChecker* bounds_checker, 93 BoundsChecker* bounds_checker,
94 const ArrayValidateParams* validate_params) { 94 const ContainerValidateParams* validate_params) {
95 if (!ValidateEncodedPointer(&input.offset)) { 95 if (!ValidateEncodedPointer(&input.offset)) {
96 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); 96 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER);
97 return false; 97 return false;
98 } 98 }
99 99
100 return Array_Data<T>::Validate(DecodePointerRaw(&input.offset), 100 return Array_Data<T>::Validate(DecodePointerRaw(&input.offset),
101 bounds_checker, validate_params); 101 bounds_checker, validate_params);
102 } 102 }
103 103
104 template <typename T> 104 template <typename T>
105 bool ValidateMap(const Pointer<T>& input, 105 bool ValidateMap(const Pointer<T>& input,
106 BoundsChecker* bounds_checker, 106 BoundsChecker* bounds_checker,
107 const ArrayValidateParams* validate_params) { 107 const ContainerValidateParams* validate_params) {
108 if (!ValidateEncodedPointer(&input.offset)) { 108 if (!ValidateEncodedPointer(&input.offset)) {
109 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); 109 ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER);
110 return false; 110 return false;
111 } 111 }
112 112
113 return T::Validate(DecodePointerRaw(&input.offset), bounds_checker, 113 return T::Validate(DecodePointerRaw(&input.offset), bounds_checker,
114 validate_params); 114 validate_params);
115 } 115 }
116 116
117 template <typename T> 117 template <typename T>
(...skipping 23 matching lines...) Expand all
141 } 141 }
142 142
143 bool ValidateHandle(const Handle_Data& input, BoundsChecker* bounds_checker); 143 bool ValidateHandle(const Handle_Data& input, BoundsChecker* bounds_checker);
144 144
145 bool ValidateAssociatedInterfaceId(InterfaceId input); 145 bool ValidateAssociatedInterfaceId(InterfaceId input);
146 146
147 } // namespace internal 147 } // namespace internal
148 } // namespace mojo 148 } // namespace mojo
149 149
150 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ 150 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/validate_params.h ('k') | mojo/public/cpp/bindings/tests/array_common_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698