| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 provides a C++ wrapping around the Mojo C API for platform handles, | 5 // This file provides a C++ wrapping around the Mojo C API for platform handles, |
| 6 // replacing the prefix of "Mojo" with a "mojo" namespace. | 6 // replacing the prefix of "Mojo" with a "mojo" namespace. |
| 7 // | 7 // |
| 8 // Please see "mojo/public/c/system/platform_handle.h" for complete | 8 // Please see "mojo/public/c/system/platform_handle.h" for complete |
| 9 // documentation of the API. | 9 // documentation of the API. |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ScopedHandle WrapPlatformFile(base::PlatformFile platform_file); | 55 ScopedHandle WrapPlatformFile(base::PlatformFile platform_file); |
| 56 | 56 |
| 57 // Unwraps a PlatformFile from a Mojo handle. | 57 // Unwraps a PlatformFile from a Mojo handle. |
| 58 MOJO_CPP_SYSTEM_EXPORT | 58 MOJO_CPP_SYSTEM_EXPORT |
| 59 MojoResult UnwrapPlatformFile(ScopedHandle handle, base::PlatformFile* file); | 59 MojoResult UnwrapPlatformFile(ScopedHandle handle, base::PlatformFile* file); |
| 60 | 60 |
| 61 // Wraps a base::SharedMemoryHandle as a Mojo handle. Takes ownership of the | 61 // Wraps a base::SharedMemoryHandle as a Mojo handle. Takes ownership of the |
| 62 // SharedMemoryHandle. Note that |read_only| is only an indicator of whether | 62 // SharedMemoryHandle. Note that |read_only| is only an indicator of whether |
| 63 // |memory_handle| only supports read-only mapping. It does NOT have any | 63 // |memory_handle| only supports read-only mapping. It does NOT have any |
| 64 // influence on the access control of the shared buffer object. | 64 // influence on the access control of the shared buffer object. |
| 65 MOJO_CPP_SYSTEM_EXPORT |
| 65 ScopedSharedBufferHandle WrapSharedMemoryHandle( | 66 ScopedSharedBufferHandle WrapSharedMemoryHandle( |
| 66 const base::SharedMemoryHandle& memory_handle, | 67 const base::SharedMemoryHandle& memory_handle, |
| 67 size_t size, | 68 size_t size, |
| 68 bool read_only); | 69 bool read_only); |
| 69 | 70 |
| 70 // Unwraps a base::SharedMemoryHandle from a Mojo handle. The caller assumes | 71 // Unwraps a base::SharedMemoryHandle from a Mojo handle. The caller assumes |
| 71 // responsibility for the lifetime of the SharedMemoryHandle. | 72 // responsibility for the lifetime of the SharedMemoryHandle. |
| 72 MOJO_CPP_SYSTEM_EXPORT MojoResult | 73 MOJO_CPP_SYSTEM_EXPORT MojoResult |
| 73 UnwrapSharedMemoryHandle(ScopedSharedBufferHandle handle, | 74 UnwrapSharedMemoryHandle(ScopedSharedBufferHandle handle, |
| 74 base::SharedMemoryHandle* memory_handle, | 75 base::SharedMemoryHandle* memory_handle, |
| 75 size_t* size, | 76 size_t* size, |
| 76 bool* read_only); | 77 bool* read_only); |
| 77 | 78 |
| 78 } // namespace mojo | 79 } // namespace mojo |
| 79 | 80 |
| 80 #endif // MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_ | 81 #endif // MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_ |
| OLD | NEW |