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

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: oops, include c.sha1. also properly merge 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
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. All handles are moved
94 // from |in_struct| to the new copy (the copies in |in_struct| are assigned an
95 // invalid handle value). This operation is useful if you want to linearize
96 // |in_struct| using the buffer backed by |buffer|. The new copy of the struct
97 // is returned, and can then be encoded.
98 // |buffer|: A mojom buffer used to allocate space for the new struct.
viettrungluu 2016/08/02 20:15:06 (Same questions about the amount of space required
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 struct MojomStructHeader* MojomStruct_DeepCopy(
102 struct MojomBuffer* buffer,
103 const struct MojomTypeDescriptorStruct* in_type_desc,
104 struct MojomStructHeader* in_struct);
105
91 MOJO_END_EXTERN_C 106 MOJO_END_EXTERN_C
92 107
93 #endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 108 #endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698