OLD | NEW |
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 #include "mojo/public/c/bindings/struct.h" | 5 #include <mojo/bindings/struct.h> |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <mojo/bindings/internal/type_descriptor.h> |
| 9 #include <mojo/bindings/union.h> |
8 #include <string.h> | 10 #include <string.h> |
9 | 11 |
10 #include "mojo/public/c/bindings/lib/type_descriptor.h" | |
11 #include "mojo/public/c/bindings/union.h" | |
12 | |
13 size_t MojomStruct_ComputeSerializedSize( | 12 size_t MojomStruct_ComputeSerializedSize( |
14 const struct MojomTypeDescriptorStruct* in_type_desc, | 13 const struct MojomTypeDescriptorStruct* in_type_desc, |
15 const struct MojomStructHeader* in_struct) { | 14 const struct MojomStructHeader* in_struct) { |
16 assert(in_struct); | 15 assert(in_struct); |
17 assert(in_type_desc); | 16 assert(in_type_desc); |
18 | 17 |
19 size_t size = in_struct->num_bytes; | 18 size_t size = in_struct->num_bytes; |
20 for (size_t i = 0; i < in_type_desc->num_entries; i++) { | 19 for (size_t i = 0; i < in_type_desc->num_entries; i++) { |
21 const struct MojomTypeDescriptorStructEntry* entry = | 20 const struct MojomTypeDescriptorStructEntry* entry = |
22 &(in_type_desc->entries[i]); | 21 &(in_type_desc->entries[i]); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 entry->elem_type, | 195 entry->elem_type, |
197 entry->elem_descriptor, | 196 entry->elem_descriptor, |
198 in_elem_data, | 197 in_elem_data, |
199 out_elem_data)) { | 198 out_elem_data)) { |
200 return false; | 199 return false; |
201 } | 200 } |
202 } | 201 } |
203 | 202 |
204 return true; | 203 return true; |
205 } | 204 } |
OLD | NEW |