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

Unified Diff: mojo/public/c/bindings/lib/type_descriptor.h

Issue 2200843002: C bindings: Implement _DeepCopy() & some unittests. (Closed) Base URL: git@github.com:domokit/mojo.git@cgen_validate
Patch Set: oops, include c.sha1. also properly merge 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/lib/type_descriptor.h
diff --git a/mojo/public/c/bindings/lib/type_descriptor.h b/mojo/public/c/bindings/lib/type_descriptor.h
index cf684ddf7d4c3a368bf8d2f486447ded67611dd5..a4cca9bb1df159ae6a99a5144045261e6c8af939 100644
--- a/mojo/public/c/bindings/lib/type_descriptor.h
+++ b/mojo/public/c/bindings/lib/type_descriptor.h
@@ -163,11 +163,11 @@ size_t MojomType_DispatchComputeSerializedSize(
bool nullable,
const void* data);
-// This helper function, depending on |type|, calls the appropriate
-// *_DispatchEncodePointersAndHandles(...). If |type| describes a pointer, it
+// This helper function, depending on |in_elem_type|, calls the appropriate
+// *_EncodePointersAndHandles(...). If |in_elem_type| describes a pointer, it
// first encodes the pointer before calling the associated
-// *_DispatchEncodePointersAndHandles(...). If |type| describes a handle, it
-// encodes handle into |inout_handles|.
+// *_EncodePointersAndHandles(...). If |in_elem_type| describes a handle, it
+// encodes the handle into |inout_handles|.
void MojomType_DispatchEncodePointersAndHandles(
enum MojomTypeDescriptorType in_elem_type,
const void* in_type_desc,
@@ -176,10 +176,10 @@ void MojomType_DispatchEncodePointersAndHandles(
uint32_t in_buf_size,
struct MojomHandleBuffer* inout_handles_buffer);
-// This helper function, depending on |type|, calls the appropriate
-// *_DispatchDeocdePointersAndHandles(...). If |type| describes a pointer, it
+// This helper function, depending on |in_elem_type|, calls the appropriate
+// *_DecodePointersAndHandles(...). If |in_elem_type| describes a pointer, it
// first decodes the offset into a pointer before calling the associated
-// *_DispatchDecodePointersAndHandles(...). If |type| describes a handle, it
+// *_DecodePointersAndHandles(...). If |in_elem_type| describes a handle, it
// decodes the handle by looking up it up in |inout_handles|.
void MojomType_DispatchDecodePointersAndHandles(
enum MojomTypeDescriptorType in_elem_type,
@@ -199,6 +199,18 @@ MojomValidationResult MojomType_DispatchValidate(
uint32_t in_num_handles,
struct MojomValidationContext* inout_context);
+// This helper function, depending on |in_elem_type|, calls the appropriate
+// *_DeepCopy(...). The result of that call is then assigned to |out_data|. If
+// |in_elem_type| describes a handle, this function moves the handle from
+// |in_data| into |out_data| and invalidates |in_data|. If |in_type_type|
+// describes a pointer to a union, it allocates space for the new union before
+// dispatching a call to MojomUnion_DeepCopy.
+void MojomType_DispatchDeepCopy(struct MojomBuffer* buffer,
+ enum MojomTypeDescriptorType in_elem_type,
+ const void* in_type_desc,
+ void* in_data,
+ void* out_data);
+
MOJO_END_EXTERN_C
#endif // MOJO_PUBLIC_C_BINDINGS_LIB_TYPE_DESCRIPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698