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 3 // found in the LICENSE file. 4 5 #ifndef MOJO_CORE_PLATFORM_HANDLE_UTILS_H_ 6 #define MOJO_CORE_PLATFORM_HANDLE_UTILS_H_ 7 8 #include "base/memory/platform_shared_memory_region.h" 9 #include "mojo/core/system_impl_export.h" 10 #include "mojo/public/c/system/platform_handle.h" 11 #include "mojo/public/c/system/types.h" 12 #include "mojo/public/cpp/platform/platform_handle.h" 13 14 namespace mojo { 15 namespace core { 16 17 // Converts a base shared memory platform handle into one (maybe two on POSIX) 18 // PlatformHandle(s). 19 MOJO_SYSTEM_IMPL_EXPORT void ExtractPlatformHandlesFromSharedMemoryRegionHandle( 20 base::subtle::PlatformSharedMemoryRegion::ScopedPlatformHandle handle, 21 PlatformHandle* extracted_handle, 22 PlatformHandle* extracted_readonly_handle); 23 24 // Converts one (maybe two on POSIX) PlatformHandle(s) to a base shared memory 25 // platform handle. 26 MOJO_SYSTEM_IMPL_EXPORT 27 base::subtle::PlatformSharedMemoryRegion::ScopedPlatformHandle 28 CreateSharedMemoryRegionHandleFromPlatformHandles( 29 PlatformHandle handle, 30 PlatformHandle readonly_handle); 31 32 } // namespace core 33 } // namespace mojo 34 35 #endif // MOJO_CORE_PLATFORM_HANDLE_UTILS_H_ 36