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

Side by Side 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 unified diff | Download patch
OLDNEW
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 // This file contains types and constants/macros common to different Mojo system 5 // This file contains types and constants/macros common to different Mojo system
6 // APIs. 6 // APIs.
7 // 7 //
8 // Note: This header should be compilable as C. 8 // Note: This header should be compilable as C.
9 9
10 #ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_ 10 #ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_
(...skipping 15 matching lines...) Expand all
26 // |MOJO_HANDLE_INVALID| - A value that is never a valid handle. 26 // |MOJO_HANDLE_INVALID| - A value that is never a valid handle.
27 27
28 typedef uint32_t MojoHandle; 28 typedef uint32_t MojoHandle;
29 29
30 #ifdef __cplusplus 30 #ifdef __cplusplus
31 const MojoHandle MOJO_HANDLE_INVALID = 0; 31 const MojoHandle MOJO_HANDLE_INVALID = 0;
32 #else 32 #else
33 #define MOJO_HANDLE_INVALID ((MojoHandle)0) 33 #define MOJO_HANDLE_INVALID ((MojoHandle)0)
34 #endif 34 #endif
35 35
36 // |MojoPlatformHandle|: A handle to an OS object. On POSIX systems this is
37 // generally a file descriptor. On OS X it might be a Mach port. On Windows,
38 // it's a HANDLE.
39 //
40 // |MOJO_PLATFORM_HANDLE_INVALID| - A value that is never treated as a valid
41 // platform handle.
42
43 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
44
45 #ifdef __cplusplus
46 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
47 #else
48 #define MOJO_PLATFORM_HANDLE_INVALID ((MojoPlatformHandle)0xffffffffffffffffULL)
49 #endif
50
36 // |MojoResult|: Result codes for Mojo operations. The only success code is zero 51 // |MojoResult|: Result codes for Mojo operations. The only success code is zero
37 // (|MOJO_RESULT_OK|); all non-zero values should be considered as error/failure 52 // (|MOJO_RESULT_OK|); all non-zero values should be considered as error/failure
38 // codes (even if the value is not recognized). 53 // codes (even if the value is not recognized).
39 // |MOJO_RESULT_OK| - Not an error; returned on success. 54 // |MOJO_RESULT_OK| - Not an error; returned on success.
40 // |MOJO_RESULT_CANCELLED| - Operation was cancelled, typically by the caller. 55 // |MOJO_RESULT_CANCELLED| - Operation was cancelled, typically by the caller.
41 // |MOJO_RESULT_UNKNOWN| - Unknown error (e.g., if not enough information is 56 // |MOJO_RESULT_UNKNOWN| - Unknown error (e.g., if not enough information is
42 // available for a more specific error). 57 // available for a more specific error).
43 // |MOJO_RESULT_INVALID_ARGUMENT| - Caller specified an invalid argument. This 58 // |MOJO_RESULT_INVALID_ARGUMENT| - Caller specified an invalid argument. This
44 // differs from |MOJO_RESULT_FAILED_PRECONDITION| in that the former 59 // differs from |MOJO_RESULT_FAILED_PRECONDITION| in that the former
45 // indicates arguments that are invalid regardless of the state of the 60 // indicates arguments that are invalid regardless of the state of the
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const MojoWatchNotificationFlags MOJO_WATCH_NOTIFICATION_FLAG_NONE = 0; 211 const MojoWatchNotificationFlags MOJO_WATCH_NOTIFICATION_FLAG_NONE = 0;
197 const MojoWatchNotificationFlags MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM = 212 const MojoWatchNotificationFlags MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM =
198 1 << 0; 213 1 << 0;
199 #else 214 #else
200 #define MOJO_WATCH_NOTIFICATION_FLAG_NONE ((MojoWatchNotificationFlags)0) 215 #define MOJO_WATCH_NOTIFICATION_FLAG_NONE ((MojoWatchNotificationFlags)0)
201 #define MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM \ 216 #define MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM \
202 ((MojoWatchNotificationFlags)1 << 0); 217 ((MojoWatchNotificationFlags)1 << 0);
203 #endif 218 #endif
204 219
205 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ 220 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698