| 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. A read-only duplicate can |
| 61 // only be created before the buffer is passed over a message pipe. |
| 59 // | 62 // |
| 60 // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? | 63 // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? |
| 61 | 64 |
| 62 typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; | 65 typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; |
| 63 | 66 |
| 64 #ifdef __cplusplus | 67 #ifdef __cplusplus |
| 65 const MojoDuplicateBufferHandleOptionsFlags | 68 const MojoDuplicateBufferHandleOptionsFlags |
| 66 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; | 69 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; |
| 70 const MojoDuplicateBufferHandleOptionsFlags |
| 71 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_READ_ONLY = 1 << 0; |
| 67 #else | 72 #else |
| 68 #define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ | 73 #define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ |
| 69 ((MojoDuplicateBufferHandleOptionsFlags)0) | 74 ((MojoDuplicateBufferHandleOptionsFlags)0) |
| 70 #endif | 75 #endif |
| 71 | 76 |
| 72 struct MojoDuplicateBufferHandleOptions { | 77 struct MojoDuplicateBufferHandleOptions { |
| 73 uint32_t struct_size; | 78 uint32_t struct_size; |
| 74 MojoDuplicateBufferHandleOptionsFlags flags; | 79 MojoDuplicateBufferHandleOptionsFlags flags; |
| 75 }; | 80 }; |
| 76 MOJO_STATIC_ASSERT(sizeof(MojoDuplicateBufferHandleOptions) == 8, | 81 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. | 184 // |MOJO_RESULT_OK| on success. |
| 180 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the | 185 // |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the |
| 181 // result of |MojoMapBuffer()| or has already been unmapped). | 186 // result of |MojoMapBuffer()| or has already been unmapped). |
| 182 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. | 187 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. |
| 183 | 188 |
| 184 #ifdef __cplusplus | 189 #ifdef __cplusplus |
| 185 } // extern "C" | 190 } // extern "C" |
| 186 #endif | 191 #endif |
| 187 | 192 |
| 188 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ | 193 #endif // MOJO_PUBLIC_C_SYSTEM_BUFFER_H_ |
| OLD | NEW |