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

Side by Side Diff: mojo/edk/embedder/embedder.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 | « no previous file | mojo/edk/embedder/platform_shared_buffer.h » ('j') | 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 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_ 5 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_
6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ 6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // on success. 87 // on success.
88 MOJO_SYSTEM_IMPL_EXPORT MojoResult 88 MOJO_SYSTEM_IMPL_EXPORT MojoResult
89 PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, 89 PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
90 ScopedPlatformHandle* platform_handle); 90 ScopedPlatformHandle* platform_handle);
91 91
92 // Creates a |MojoHandle| that wraps the given |SharedMemoryHandle| (taking 92 // Creates a |MojoHandle| that wraps the given |SharedMemoryHandle| (taking
93 // ownership of it). |num_bytes| is the size of the shared memory object, and 93 // ownership of it). |num_bytes| is the size of the shared memory object, and
94 // |read_only| is whether the handle is a read-only handle to shared memory. 94 // |read_only| is whether the handle is a read-only handle to shared memory.
95 // This |MojoHandle| is a Mojo shared buffer and can be manipulated using the 95 // This |MojoHandle| is a Mojo shared buffer and can be manipulated using the
96 // shared buffer functions and transferred over a message pipe. 96 // shared buffer functions and transferred over a message pipe.
97 // TODO(crbug.com/556587): Support read-only handles. Currently, |read_only|
98 // must be false.
99 MOJO_SYSTEM_IMPL_EXPORT MojoResult 97 MOJO_SYSTEM_IMPL_EXPORT MojoResult
100 CreateSharedBufferWrapper(base::SharedMemoryHandle shared_memory_handle, 98 CreateSharedBufferWrapper(base::SharedMemoryHandle shared_memory_handle,
101 size_t num_bytes, 99 size_t num_bytes,
102 bool read_only, 100 bool read_only,
103 MojoHandle* mojo_wrapper_handle); 101 MojoHandle* mojo_wrapper_handle);
104 102
105 // Retrieves the underlying |SharedMemoryHandle| from a shared buffer 103 // Retrieves the underlying |SharedMemoryHandle| from a shared buffer
106 // |MojoHandle| and closes the handle. If successful, |num_bytes| will contain 104 // |MojoHandle| and closes the handle. If successful, |num_bytes| will contain
107 // the size of the shared memory buffer and |read_only| will contain whether the 105 // the size of the shared memory buffer and |read_only| will contain whether the
108 // buffer handle is read-only. Both |num_bytes| and |read_only| may be null. 106 // buffer handle is read-only. Both |num_bytes| and |read_only| may be null.
109 // Note: The value of |shared_memory_handle| may be 107 // Note: The value of |shared_memory_handle| may be
110 // base::SharedMemory::NULLHandle(), even if this function returns success. 108 // base::SharedMemory::NULLHandle(), even if this function returns success.
111 // Callers should perform appropriate checks. 109 // Callers should perform appropriate checks.
112 // TODO(crbug.com/556587): Support read-only handles. Currently, |read_only|
113 // will always return |false|.
114 MOJO_SYSTEM_IMPL_EXPORT MojoResult 110 MOJO_SYSTEM_IMPL_EXPORT MojoResult
115 PassSharedMemoryHandle(MojoHandle mojo_handle, 111 PassSharedMemoryHandle(MojoHandle mojo_handle,
116 base::SharedMemoryHandle* shared_memory_handle, 112 base::SharedMemoryHandle* shared_memory_handle,
117 size_t* num_bytes, 113 size_t* num_bytes,
118 bool* read_only); 114 bool* read_only);
119 115
120 // Initialialization/shutdown for interprocess communication (IPC) ------------- 116 // Initialialization/shutdown for interprocess communication (IPC) -------------
121 117
122 // |InitIPCSupport()| sets up the subsystem for interprocess communication, 118 // |InitIPCSupport()| sets up the subsystem for interprocess communication,
123 // making the IPC functions (in the following section) available and functional. 119 // making the IPC functions (in the following section) available and functional.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 168
173 // Generates a random ASCII token string for use with CreateParentMessagePipe() 169 // Generates a random ASCII token string for use with CreateParentMessagePipe()
174 // and CreateChildMessagePipe() above. The generated token is suitably random so 170 // and CreateChildMessagePipe() above. The generated token is suitably random so
175 // as to not have to worry about collisions with other generated tokens. 171 // as to not have to worry about collisions with other generated tokens.
176 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); 172 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken();
177 173
178 } // namespace edk 174 } // namespace edk
179 } // namespace mojo 175 } // namespace mojo
180 176
181 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ 177 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/embedder/platform_shared_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698