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

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

Issue 2200843002: C bindings: Implement _DeepCopy() & some unittests. (Closed) Base URL: git@github.com:domokit/mojo.git@cgen_validate
Patch Set: fix tab indent, update sha1 Created 4 years, 4 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 | « no previous file | 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 93134be53e9ad0fc53ed25e49b8e54d197b1f3dd..fb18b070b7fbbf34eafa0e8ead10d976dfc3a462 100644
--- a/mojo/public/c/bindings/array.h
+++ b/mojo/public/c/bindings/array.h
@@ -114,6 +114,22 @@ MojomValidationResult MojomArray_Validate(
uint32_t in_num_handles,
struct MojomValidationContext* inout_context);
+// Creates a new copy of |in_array| using |buffer| to allocate space.
+// Recursively creates new copies of any references from |in_array|, and updates
+// the references to point to the new copies. This operation is useful if you
+// want to linearize |in_array| using the buffer backed by |buffer|. If there is
+// insufficient space in the buffer or has unknown-typed data, this function
+// returns false and the supplied buffer may be partially used. Otherwise,
+// |out_array| is set to the new copy of the struct.
+// |buffer|: A mojom buffer used to allocate space for the new array.
+// |in_type_desc|: Describes the pointer and handle fields of the mojom array.
+// |in_array|: The unencoded mojom array to be copied.
+// |out_array|: Will be set to the new unencoded mojom array.
+bool MojomArray_DeepCopy(struct MojomBuffer* buffer,
+ const struct MojomTypeDescriptorArray* in_type_desc,
+ const struct MojomArrayHeader* in_array,
+ struct MojomArrayHeader** out_array);
+
MOJO_END_EXTERN_C
#endif // MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
« no previous file with comments | « no previous file | mojo/public/c/bindings/lib/array.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698