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

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

Issue 1689053003: Support read-only duplicates of Mojo shared buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-shm-interop
Patch Set: Rebase and fix comment. Created 4 years, 8 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/edk/test/mojo_test_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « mojo/edk/test/mojo_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698