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

Unified Diff: mojo/public/c/bindings/lib/util.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/lib/union.c ('k') | mojo/public/c/bindings/map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/c/bindings/lib/util.h
diff --git a/mojo/public/c/bindings/lib/util.h b/mojo/public/c/bindings/lib/util.h
index bbbe7e62352bbac7bf1d4fdbb07a9aaf97daeb10..5259f5c5ad19a69e066a5e0edb53413606455442 100644
--- a/mojo/public/c/bindings/lib/util.h
+++ b/mojo/public/c/bindings/lib/util.h
@@ -19,4 +19,19 @@ union MojomPointer {
MOJO_STATIC_ASSERT(sizeof(union MojomPointer) == 8,
"union MojomPointer must be 8 bytes");
+// This struct represents the state we need to keep when validating an encoded
+// mojom type.
+struct MojomValidationContext {
+ // |next_handle_index| is a counter that represents the next-available index
+ // into the handle array. Previous indices have already been used up. This
+ // counter is non-decreasing as it is used throughout validation.
+ uint32_t next_handle_index;
+
+ // As we validate, we keep track of the point where pointers can point to,
+ // since two pointers may not point to the same memory region.
+ char* next_pointer;
+
+ // TODO(vardhan): Include an error string? How big should it be?
+};
+
#endif // MOJO_PUBLIC_C_BINDINGS_LIB_UTIL_H_
« no previous file with comments | « mojo/public/c/bindings/lib/union.c ('k') | mojo/public/c/bindings/map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698