OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains types/constants and functions specific to buffers (and in | 5 // This file contains types/constants and functions specific to buffers (and in |
6 // particular shared buffers). | 6 // particular shared buffers). |
7 // TODO(vtl): Reorganize this file (etc.) to separate general buffer functions | 7 // TODO(vtl): Reorganize this file (etc.) to separate general buffer functions |
8 // from (shared) buffer creation. | 8 // from (shared) buffer creation. |
9 // | 9 // |
10 // Note: This header should be compilable as C. | 10 // Note: This header should be compilable as C. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 MOJO_STATIC_ASSERT(sizeof(MojoBufferInformation) == 16, | 85 MOJO_STATIC_ASSERT(sizeof(MojoBufferInformation) == 16, |
86 "MojoBufferInformation has wrong size"); | 86 "MojoBufferInformation has wrong size"); |
87 | 87 |
88 // |MojoMapBufferFlags|: Used to specify different modes to |MojoMapBuffer()|. | 88 // |MojoMapBufferFlags|: Used to specify different modes to |MojoMapBuffer()|. |
89 // |MOJO_MAP_BUFFER_FLAG_NONE| - No flags; default mode. | 89 // |MOJO_MAP_BUFFER_FLAG_NONE| - No flags; default mode. |
90 | 90 |
91 typedef uint32_t MojoMapBufferFlags; | 91 typedef uint32_t MojoMapBufferFlags; |
92 | 92 |
93 #define MOJO_MAP_BUFFER_FLAG_NONE ((MojoMapBufferFlags)0) | 93 #define MOJO_MAP_BUFFER_FLAG_NONE ((MojoMapBufferFlags)0) |
94 | 94 |
95 #ifdef __cplusplus | 95 MOJO_BEGIN_EXTERN_C |
96 extern "C" { | |
97 #endif | |
98 | 96 |
99 // Creates a buffer of size |num_bytes| bytes that can be shared between | 97 // Creates a buffer of size |num_bytes| bytes that can be shared between |
100 // applications (by duplicating the handle -- see |MojoDuplicateBufferHandle()| | 98 // applications (by duplicating the handle -- see |MojoDuplicateBufferHandle()| |
101 // -- and passing it over a message pipe). To access the buffer, one must call | 99 // -- and passing it over a message pipe). To access the buffer, one must call |
102 // |MojoMapBuffer()|. | 100 // |MojoMapBuffer()|. |
103 // | 101 // |
104 // |options| may be set to null for a shared buffer with the default options. | 102 // |options| may be set to null for a shared buffer with the default options. |
105 // | 103 // |
106 // On success, |*shared_buffer_handle| will be set to the handle for the shared | 104 // On success, |*shared_buffer_handle| will be set to the handle for the shared |
107 // buffer. (On failure, it is not modified.) | 105 // buffer. (On failure, it is not modified.) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // have been the result of |MojoMapBuffer()| (not some other pointer inside | 194 // have been the result of |MojoMapBuffer()| (not some other pointer inside |
197 // the mapped memory), and the entire mapping will be removed (partial unmapping | 195 // the mapped memory), and the entire mapping will be removed (partial unmapping |
198 // is not supported). A mapping may only be unmapped once. | 196 // is not supported). A mapping may only be unmapped once. |
199 // | 197 // |
200 // Returns: | 198 // Returns: |
201 // |MOJO_RESULT_OK| on success. | 199 // |MOJO_RESULT_OK| on success. |
202 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the | 200 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the |
203 // result of |MojoMapBuffer()| or has already been unmapped). | 201 // result of |MojoMapBuffer()| or has already been unmapped). |
204 MojoResult MojoUnmapBuffer(void* buffer); // In. | 202 MojoResult MojoUnmapBuffer(void* buffer); // In. |
205 | 203 |
206 #ifdef __cplusplus | 204 MOJO_END_EXTERN_C |
207 } // extern "C" | |
208 #endif | |
209 | 205 |
210 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ | 206 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ |
OLD | NEW |