Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_PUBLIC_C_BINDINGS_BUFFER_H_ | |
| 6 #define MOJO_PUBLIC_C_BINDINGS_BUFFER_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "mojo/public/c/system/macros.h" | |
| 11 | |
| 12 MOJO_BEGIN_EXTERN_C | |
| 13 | |
| 14 // |MojomBuffer| is an object that manages a buffer. It is used as a | |
|
viettrungluu
2016/06/15 15:00:57
nit: "object" and "manages" are both stretches. Pr
vardhan
2016/06/15 15:48:00
Done.
| |
| 15 // linear allocator for mojom serialization. The user must initialize this | |
| 16 // struct themselves. See the fields for details. | |
| 17 struct MojomBuffer { | |
| 18 char* buf; | |
| 19 // The number of bytes described by |buf|. | |
| 20 size_t buf_size; | |
| 21 // Must be initialized to 0. MojomBuffer_Allocate() will update it as it | |
| 22 // consumes |buf|. | |
| 23 size_t num_bytes_used; | |
| 24 }; | |
| 25 | |
| 26 // Allocates |num_bytes| (aligned to 8 bytes) from |buf|. | |
|
viettrungluu
2016/06/15 15:00:57
nit: "aligned" -> "rounded up to a multiple of", s
vardhan
2016/06/15 15:48:00
Done.
| |
| 27 void* MojomBuffer_Allocate(struct MojomBuffer* buf, size_t num_bytes); | |
| 28 | |
| 29 MOJO_END_EXTERN_C | |
| 30 | |
| 31 #endif // MOJO_PUBLIC_C_BINDINGS_BUFFER_H_ | |
| OLD | NEW |