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

Side by Side Diff: mojo/public/c/bindings/buffer.h

Issue 2062323002: Mojo C bindings library pt1: MojomBuffer (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: MojomBuffer_Allocate(0) succeeds Created 4 years, 6 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/BUILD.gn ('k') | mojo/public/c/bindings/lib/buffer.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 <stdint.h>
9
10 #include "mojo/public/c/system/macros.h"
11
12 MOJO_BEGIN_EXTERN_C
13
14 // |MojomBuffer| is used to track a buffer state for mojom serialization. The
15 // user must initialize this struct themselves. See the fields for details.
16 struct MojomBuffer {
17 char* buf;
18 // The number of bytes described by |buf|.
19 uint32_t buf_size;
20 // Must be initialized to 0. MojomBuffer_Allocate() will update it as it
21 // consumes |buf|.
22 uint32_t num_bytes_used;
23 };
24
25 // Allocates |num_bytes| (rounded to 8 bytes) from |buf|. Returns NULL if
26 // there isn't enough space left to allocate.
27 void* MojomBuffer_Allocate(struct MojomBuffer* buf, uint32_t num_bytes);
28
29 MOJO_END_EXTERN_C
30
31 #endif // MOJO_PUBLIC_C_BINDINGS_BUFFER_H_
OLDNEW
« no previous file with comments | « mojo/public/c/bindings/BUILD.gn ('k') | mojo/public/c/bindings/lib/buffer.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698