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

Side by Side Diff: mojo/public/c/bindings/struct.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 unified diff | Download patch
« no previous file with comments | « mojo/public/c/bindings/lib/union.c ('k') | mojo/public/c/bindings/tests/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 5 #ifndef MOJO_PUBLIC_C_BINDINGS_STRUCT_H_
6 #define MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 6 #define MOJO_PUBLIC_C_BINDINGS_STRUCT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // |inout_context|: An initialized context that contains the expected location 81 // |inout_context|: An initialized context that contains the expected location
82 // of the next pointer and next offset. This is used to 82 // of the next pointer and next offset. This is used to
83 // validate that no two pointers or handles are shared. 83 // validate that no two pointers or handles are shared.
84 MojomValidationResult MojomStruct_Validate( 84 MojomValidationResult MojomStruct_Validate(
85 const struct MojomTypeDescriptorStruct* in_type_desc, 85 const struct MojomTypeDescriptorStruct* in_type_desc,
86 const struct MojomStructHeader* in_struct, 86 const struct MojomStructHeader* in_struct,
87 uint32_t in_struct_size, 87 uint32_t in_struct_size,
88 uint32_t in_num_handles, 88 uint32_t in_num_handles,
89 struct MojomValidationContext* inout_context); 89 struct MojomValidationContext* inout_context);
90 90
91 // Creates a new copy of |in_struct| using |buffer| to allocate space.
92 // Recursively creates new copies of any references from |in_struct|, and
93 // updates the references to point to the new copies. This operation is useful
94 // if you want to linearize |in_struct| using the buffer backed by |buffer|. If
95 // there is insufficient space in the buffer or has unknown-typed data, this
96 // function returns false and the supplied buffer may be partially used.
97 // Otherwise, |out_struct| is set to the new copy of the struct.
98 // |buffer|: A mojom buffer used to allocate space for the new struct.
99 // |in_type_desc|: Describes the pointer and handle fields of the mojom struct.
100 // |in_struct|: The unencoded mojom struct to be copied.
101 // |out_struct|: Will be set to the new unencoded mojom struct.
102 bool MojomStruct_DeepCopy(struct MojomBuffer* buffer,
103 const struct MojomTypeDescriptorStruct* in_type_desc,
104 const struct MojomStructHeader* in_struct,
105 struct MojomStructHeader** out_struct);
106
91 MOJO_END_EXTERN_C 107 MOJO_END_EXTERN_C
92 108
93 #endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 109 #endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_
OLDNEW
« no previous file with comments | « mojo/public/c/bindings/lib/union.c ('k') | mojo/public/c/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698