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

Unified Diff: mojo/public/c/bindings/union.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
Index: mojo/public/c/bindings/union.h
diff --git a/mojo/public/c/bindings/union.h b/mojo/public/c/bindings/union.h
index 30f8cde66f166bb716523c3fcfce093a80461ce6..0dfb4b642c994f2c4b90f9733ee036aab1c47ebd 100644
--- a/mojo/public/c/bindings/union.h
+++ b/mojo/public/c/bindings/union.h
@@ -97,6 +97,23 @@ MojomValidationResult MojomUnion_Validate(
uint32_t in_num_handles,
struct MojomValidationContext* inout_context);
+// Copies over |in_union_data| into |out_union_data|, recursively copying any
+// references from |in_union_data| using |buffer| to allocate space, and
+// updating the references to point to the new copies. Note that a space is
+// never allocated for the new union data in this function -- |out_union_data|
+// should already be allocated for this function ahead of time. Returns false if
+// the copy couldn't be made (insufficient space, or unrecognized tag), in which
+// case the buffer may be partially used.
+// |buffer|: A mojom buffer used to allocate space for any references from the
+// union.
+// |in_type_desc|: Describes the pointer and handle fields of the mojom union.
+// |in_union_data|: The unencoded mojom union to be copied.
+// |out_union_data|: Where |in_union_data| should be copied to.
+bool MojomUnion_DeepCopy(struct MojomBuffer* buffer,
+ const struct MojomTypeDescriptorUnion* in_type_desc,
+ const struct MojomUnionLayout* in_union_data,
+ struct MojomUnionLayout* out_union_data);
+
MOJO_END_EXTERN_C
#endif // MOJO_PUBLIC_C_BINDINGS_UNION_H_
« no previous file with comments | « mojo/public/c/bindings/tests/union_unittest.cc ('k') | mojo/public/tools/bindings/mojom_tool/bin/linux64/generators/c.sha1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698