| 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 #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  Loading... | 
| 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  Loading... | 
| 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_ | 
| OLD | NEW | 
|---|