OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_PLATFORM_HANDLE_PRIVATE_H_ |
| 6 #define MOJO_PUBLIC_PLATFORM_NATIVE_PLATFORM_HANDLE_PRIVATE_H_ |
| 7 |
| 8 #include "mojo/public/c/system/types.h" |
| 9 |
| 10 typedef int MojoPlatformHandle; // Unix file descriptor |
| 11 |
| 12 #ifdef __cplusplus |
| 13 extern "C" { |
| 14 #endif |
| 15 |
| 16 // Wraps |platform_handle| in a MojoHandle so that it can transported. Returns |
| 17 // MOJO_RESULT_OK on success, all other results indicate failure. This takes |
| 18 // ownership of |platform_handle|, regardless of whether this succeeds. |
| 19 MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle, |
| 20 MojoHandle* wrapper); |
| 21 |
| 22 // Extracts |platform_handle| from |wrapper|. Returns MOJO_RESULT_OK on success, |
| 23 // all other results indicate failure. If this succeeds, it causes |wrapper| to |
| 24 // relinquish ownership of |platform_handle|, so MojoClose'ing |wrapper| will no |
| 25 // longer close the underlying |platform_handle|. Never the less, it is still |
| 26 // neccessary to MojoClose |wrapper|, but this will not affect the underlying |
| 27 // descriptor after this call. |
| 28 MojoResult MojoExtractPlatformHandle(MojoHandle wrapper, |
| 29 MojoPlatformHandle* platform_handle); |
| 30 |
| 31 #ifdef __cplusplus |
| 32 } // extern "C" |
| 33 #endif |
| 34 |
| 35 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_PLATFORM_HANDLE_PRIVATE_H_ |
OLD | NEW |