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

Unified Diff: mojo/public/c/system/types.h

Issue 1995753002: [mojo-edk] Expose portable API for platform handle wrapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/c/system/types.h
diff --git a/mojo/public/c/system/types.h b/mojo/public/c/system/types.h
index 6d21b12a172aefc805a98354479dd1fd1ceaef52..76ef5638c4cc168d7367bb0cdfebb58d2ef28c14 100644
--- a/mojo/public/c/system/types.h
+++ b/mojo/public/c/system/types.h
@@ -33,6 +33,21 @@ const MojoHandle MOJO_HANDLE_INVALID = 0;
#define MOJO_HANDLE_INVALID ((MojoHandle)0)
#endif
+// |MojoPlatformHandle|: A handle to an OS object. On POSIX systems this is
+// generally a file descriptor. On OS X it might be a Mach port. On Windows,
+// it's a HANDLE.
+//
+// |MOJO_PLATFORM_HANDLE_INVALID| - A value that is never treated as a valid
+// platform handle.
+
+typedef uint64_t MojoPlatformHandle;
Anand Mistry (off Chromium) 2016/05/20 06:25:40 I don't like the fact that the meaning here is con
Ken Rockot(use gerrit already) 2016/05/20 22:19:43 I took it a step further and decided we should hav
+
+#ifdef __cplusplus
+const MojoPlatformHandle MOJO_PLATFORM_HANDLE_INVALID = 0xffffffffffffffffULL;
Anand Mistry (off Chromium) 2016/05/20 06:25:40 static_cast<>(-1) is the common pattern here.
Ken Rockot(use gerrit already) 2016/05/20 22:19:43 WontFix (Obsolete) With a concept of "handle type
+#else
+#define MOJO_PLATFORM_HANDLE_INVALID ((MojoPlatformHandle)0xffffffffffffffffULL)
+#endif
+
// |MojoResult|: Result codes for Mojo operations. The only success code is zero
// (|MOJO_RESULT_OK|); all non-zero values should be considered as error/failure
// codes (even if the value is not recognized).

Powered by Google App Engine
This is Rietveld 408576698