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

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

Issue 2163793002: C bindings: Implement _Validate(), and some pre-requisites (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address comments 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
« no previous file with comments | « mojo/public/c/bindings/BUILD.gn ('k') | mojo/public/c/bindings/lib/array.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/c/bindings/array.h
diff --git a/mojo/public/c/bindings/array.h b/mojo/public/c/bindings/array.h
index 3baef1a1888af1d8c93c79fd85822d8b1838dd91..93134be53e9ad0fc53ed25e49b8e54d197b1f3dd 100644
--- a/mojo/public/c/bindings/array.h
+++ b/mojo/public/c/bindings/array.h
@@ -95,6 +95,25 @@ void MojomArray_DecodePointersAndHandles(
MojoHandle* inout_handles,
uint32_t in_num_handles);
+// Validates the mojom array described by the |in_struct| buffer. Any
+// references from the array are also recursively validated, and are expected
+// to be in the same buffer backing |in_array|.
+// |in_type_desc|: Describes the pointer and handle fields of the mojom array.
+// |in_array|: Buffer containing the array, and any other references outside of
+// the array
+// |in_array_size|: Size of the buffer backed by |in_array| in bytes.
+// |in_num_handles|: Number of valid handles expected to be referenced from
+// |in_array|.
+// |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 MojomArray_Validate(
+ const struct MojomTypeDescriptorArray* in_type_desc,
+ const struct MojomArrayHeader* in_array,
+ uint32_t in_array_size,
+ uint32_t in_num_handles,
+ struct MojomValidationContext* inout_context);
+
MOJO_END_EXTERN_C
#endif // MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
« no previous file with comments | « mojo/public/c/bindings/BUILD.gn ('k') | mojo/public/c/bindings/lib/array.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698