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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // |offset| and |num_bytes| is not valid). | 162 // |offset| and |num_bytes| is not valid). |
163 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if the mapping operation itself failed | 163 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if the mapping operation itself failed |
164 // (e.g., due to not having appropriate address space available). | 164 // (e.g., due to not having appropriate address space available). |
165 MOJO_SYSTEM_EXPORT MojoResult MojoMapBuffer(MojoHandle buffer_handle, | 165 MOJO_SYSTEM_EXPORT MojoResult MojoMapBuffer(MojoHandle buffer_handle, |
166 uint64_t offset, | 166 uint64_t offset, |
167 uint64_t num_bytes, | 167 uint64_t num_bytes, |
168 void** buffer, // Out. | 168 void** buffer, // Out. |
169 MojoMapBufferFlags flags); | 169 MojoMapBufferFlags flags); |
170 | 170 |
171 // Unmaps a buffer pointer that was mapped by |MojoMapBuffer()|. |buffer| must | 171 // Unmaps a buffer pointer that was mapped by |MojoMapBuffer()|. |buffer| must |
172 // have been the result of |MojoMapBuffer()| (not some pointer strictly inside | 172 // have been the result of |MojoMapBuffer()| (not some other pointer inside |
173 // the mapped memory), and the entire mapping will be removed (partial unmapping | 173 // the mapped memory), and the entire mapping will be removed (partial unmapping |
174 // is not supported). A mapping may only be unmapped exactly once. | 174 // is not supported). A mapping may only be unmapped once. |
175 // | 175 // |
176 // Returns: | 176 // Returns: |
177 // |MOJO_RESULT_OK| on success. | 177 // |MOJO_RESULT_OK| on success. |
178 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the | 178 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the |
179 // result of |MojoMapBuffer()| or has already been unmapped). | 179 // result of |MojoMapBuffer()| or has already been unmapped). |
180 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. | 180 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. |
181 | 181 |
182 #ifdef __cplusplus | 182 #ifdef __cplusplus |
183 } // extern "C" | 183 } // extern "C" |
184 #endif | 184 #endif |
185 | 185 |
186 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ | 186 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ |
OLD | NEW |