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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 "MojoCreateSharedBufferOptions has wrong size"); | 49 "MojoCreateSharedBufferOptions has wrong size"); |
50 | 50 |
51 // |MojoDuplicateBufferHandleOptions|: Used to specify parameters in duplicating | 51 // |MojoDuplicateBufferHandleOptions|: Used to specify parameters in duplicating |
52 // access to a shared buffer to |MojoDuplicateBufferHandle()|. | 52 // access to a shared buffer to |MojoDuplicateBufferHandle()|. |
53 // |uint32_t struct_size|: Set to the size of the | 53 // |uint32_t struct_size|: Set to the size of the |
54 // |MojoDuplicateBufferHandleOptions| struct. (Used to allow for future | 54 // |MojoDuplicateBufferHandleOptions| struct. (Used to allow for future |
55 // extensions.) | 55 // extensions.) |
56 // |MojoDuplicateBufferHandleOptionsFlags flags|: Reserved for future use. | 56 // |MojoDuplicateBufferHandleOptionsFlags flags|: Reserved for future use. |
57 // |MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE|: No flags; default | 57 // |MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE|: No flags; default |
58 // mode. | 58 // mode. |
| 59 // |MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_READ_ONLY|: The duplicate |
| 60 // shared buffer can only be mapped read-only. |
59 // | 61 // |
60 // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? | 62 // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? |
61 | 63 |
62 typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; | 64 typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; |
63 | 65 |
64 #ifdef __cplusplus | 66 #ifdef __cplusplus |
65 const MojoDuplicateBufferHandleOptionsFlags | 67 const MojoDuplicateBufferHandleOptionsFlags |
66 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; | 68 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; |
| 69 const MojoDuplicateBufferHandleOptionsFlags |
| 70 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_READ_ONLY = 1 << 0; |
67 #else | 71 #else |
68 #define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ | 72 #define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ |
69 ((MojoDuplicateBufferHandleOptionsFlags)0) | 73 ((MojoDuplicateBufferHandleOptionsFlags)0) |
70 #endif | 74 #endif |
71 | 75 |
72 struct MojoDuplicateBufferHandleOptions { | 76 struct MojoDuplicateBufferHandleOptions { |
73 uint32_t struct_size; | 77 uint32_t struct_size; |
74 MojoDuplicateBufferHandleOptionsFlags flags; | 78 MojoDuplicateBufferHandleOptionsFlags flags; |
75 }; | 79 }; |
76 MOJO_STATIC_ASSERT(sizeof(MojoDuplicateBufferHandleOptions) == 8, | 80 MOJO_STATIC_ASSERT(sizeof(MojoDuplicateBufferHandleOptions) == 8, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // |MOJO_RESULT_OK| on success. | 183 // |MOJO_RESULT_OK| on success. |
180 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the | 184 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the |
181 // result of |MojoMapBuffer()| or has already been unmapped). | 185 // result of |MojoMapBuffer()| or has already been unmapped). |
182 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. | 186 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. |
183 | 187 |
184 #ifdef __cplusplus | 188 #ifdef __cplusplus |
185 } // extern "C" | 189 } // extern "C" |
186 #endif | 190 #endif |
187 | 191 |
188 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ | 192 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ |
OLD | NEW |