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

Unified Diff: mojo/public/c/bindings/union.h

Issue 2163793002: C bindings: Implement _Validate(), and some pre-requisites (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: share common validation utility code between c/c++ tests. remove generating __HasResponse for inte… Created 4 years, 5 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/c/bindings/union.h
diff --git a/mojo/public/c/bindings/union.h b/mojo/public/c/bindings/union.h
index a9984e39dfb1bc0b1c7bf2d49ae2c29138ba4103..30f8cde66f166bb716523c3fcfce093a80461ce6 100644
--- a/mojo/public/c/bindings/union.h
+++ b/mojo/public/c/bindings/union.h
@@ -77,6 +77,26 @@ void MojomUnion_DecodePointersAndHandles(
MojoHandle* inout_handles,
uint32_t in_num_handles);
+// Validates the mojom union described by the |in_union| buffer. Any
+// references from the union are also recursively validated, and are expected to
+// be in the same buffer backing |in_union|.
+// |in_type_desc|: Describes the pointer and handle fields of the mojom union.
+// |in_union|: Buffer containing the union, and any other references
+// outside of the union.
+// |in_union_size|: Size of the buffer backed by |in_union| in bytes.
+// |in_num_handles|: Number of valid handles expected to be referenced from
+// |in_union|.
+// |inout_context|: An initialized context that contains the expected location
+// of the next pointer and next offset. This is used to
+// validate that no two pointers or handles are shared.
+MojomValidationResult MojomUnion_Validate(
+ const struct MojomTypeDescriptorUnion* in_type_desc,
+ bool in_nullable,
+ const struct MojomUnionLayout* in_union,
+ uint32_t in_union_size,
+ uint32_t in_num_handles,
+ struct MojomValidationContext* inout_context);
+
MOJO_END_EXTERN_C
#endif // MOJO_PUBLIC_C_BINDINGS_UNION_H_

Powered by Google App Engine
This is Rietveld 408576698