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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/c/bindings/lib/array.c » ('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_ARRAY_H_ 5 #ifndef MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
6 #define MOJO_PUBLIC_C_BINDINGS_ARRAY_H_ 6 #define MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "mojo/public/c/bindings/buffer.h" 10 #include "mojo/public/c/bindings/buffer.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // |inout_context|: An initialized context that contains the expected location 107 // |inout_context|: An initialized context that contains the expected location
108 // of the next pointer and next offset. This is used to 108 // of the next pointer and next offset. This is used to
109 // validate that no two pointers or handles are shared. 109 // validate that no two pointers or handles are shared.
110 MojomValidationResult MojomArray_Validate( 110 MojomValidationResult MojomArray_Validate(
111 const struct MojomTypeDescriptorArray* in_type_desc, 111 const struct MojomTypeDescriptorArray* in_type_desc,
112 const struct MojomArrayHeader* in_array, 112 const struct MojomArrayHeader* in_array,
113 uint32_t in_array_size, 113 uint32_t in_array_size,
114 uint32_t in_num_handles, 114 uint32_t in_num_handles,
115 struct MojomValidationContext* inout_context); 115 struct MojomValidationContext* inout_context);
116 116
117 // Creates a new copy of |in_array| using |buffer| to allocate space.
118 // Recursively creates new copies of any references from |in_array|, and updates
119 // the references to point to the new copies. This operation is useful if you
120 // want to linearize |in_array| using the buffer backed by |buffer|. If there is
121 // insufficient space in the buffer or has unknown-typed data, this function
122 // returns false and the supplied buffer may be partially used. Otherwise,
123 // |out_array| is set to the new copy of the struct.
124 // |buffer|: A mojom buffer used to allocate space for the new array.
125 // |in_type_desc|: Describes the pointer and handle fields of the mojom array.
126 // |in_array|: The unencoded mojom array to be copied.
127 // |out_array|: Will be set to the new unencoded mojom array.
128 bool MojomArray_DeepCopy(struct MojomBuffer* buffer,
129 const struct MojomTypeDescriptorArray* in_type_desc,
130 const struct MojomArrayHeader* in_array,
131 struct MojomArrayHeader** out_array);
132
117 MOJO_END_EXTERN_C 133 MOJO_END_EXTERN_C
118 134
119 #endif // MOJO_PUBLIC_C_BINDINGS_ARRAY_H_ 135 #endif // MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
OLDNEW
« 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