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

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

Issue 1518293002: [mojo] Add Mojo bindings support for IPC::ParamTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle4
Patch Set: Created 5 years 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/string_serialization.cc ('k') | mojo/public/cpp/bindings/message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/validation_util.h
diff --git a/mojo/public/cpp/bindings/lib/validation_util.h b/mojo/public/cpp/bindings/lib/validation_util.h
index 41049c03c9880168d6755ad4d6311dae0fe8fa88..4b3f0ab1b44b02b3b929a811320940562a060b53 100644
--- a/mojo/public/cpp/bindings/lib/validation_util.h
+++ b/mojo/public/cpp/bindings/lib/validation_util.h
@@ -116,6 +116,19 @@ bool ValidateStruct(const StructPointer<T>& input,
}
template <typename T>
+bool ValidateNative(const NativePointer<T>& input,
+ BoundsChecker* bounds_checker) {
+ if (!ValidateEncodedPointer(&input.offset)) {
+ ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER);
+ return false;
+ }
+
+ // Native types perform validation during deserialization.
+ DecodePointerRaw(&input.offset);
+ return true;
+}
+
+template <typename T>
bool ValidateInlinedUnion(const T& input, BoundsChecker* bounds_checker) {
return T::Validate(&input, bounds_checker, true);
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/string_serialization.cc ('k') | mojo/public/cpp/bindings/message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698