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

Side by Side Diff: mojo/public/c/system/types.h

Issue 1059543002: Make MojoResults positive. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // 86 //
87 // The codes from |MOJO_RESULT_OK| to |MOJO_RESULT_DATA_LOSS| come from 87 // The codes from |MOJO_RESULT_OK| to |MOJO_RESULT_DATA_LOSS| come from
88 // Google3's canonical error codes. 88 // Google3's canonical error codes.
89 // 89 //
90 // TODO(vtl): Add a |MOJO_RESULT_UNSATISFIABLE|? 90 // TODO(vtl): Add a |MOJO_RESULT_UNSATISFIABLE|?
91 91
92 typedef int32_t MojoResult; 92 typedef int32_t MojoResult;
93 93
94 #ifdef __cplusplus 94 #ifdef __cplusplus
95 const MojoResult MOJO_RESULT_OK = 0; 95 const MojoResult MOJO_RESULT_OK = 0;
96 const MojoResult MOJO_RESULT_CANCELLED = -1; 96 const MojoResult MOJO_RESULT_CANCELLED = 1;
97 const MojoResult MOJO_RESULT_UNKNOWN = -2; 97 const MojoResult MOJO_RESULT_UNKNOWN = 2;
98 const MojoResult MOJO_RESULT_INVALID_ARGUMENT = -3; 98 const MojoResult MOJO_RESULT_INVALID_ARGUMENT = 3;
99 const MojoResult MOJO_RESULT_DEADLINE_EXCEEDED = -4; 99 const MojoResult MOJO_RESULT_DEADLINE_EXCEEDED = 4;
100 const MojoResult MOJO_RESULT_NOT_FOUND = -5; 100 const MojoResult MOJO_RESULT_NOT_FOUND = 5;
101 const MojoResult MOJO_RESULT_ALREADY_EXISTS = -6; 101 const MojoResult MOJO_RESULT_ALREADY_EXISTS = 6;
102 const MojoResult MOJO_RESULT_PERMISSION_DENIED = -7; 102 const MojoResult MOJO_RESULT_PERMISSION_DENIED = 7;
103 const MojoResult MOJO_RESULT_RESOURCE_EXHAUSTED = -8; 103 const MojoResult MOJO_RESULT_RESOURCE_EXHAUSTED = 8;
104 const MojoResult MOJO_RESULT_FAILED_PRECONDITION = -9; 104 const MojoResult MOJO_RESULT_FAILED_PRECONDITION = 9;
105 const MojoResult MOJO_RESULT_ABORTED = -10; 105 const MojoResult MOJO_RESULT_ABORTED = 10;
106 const MojoResult MOJO_RESULT_OUT_OF_RANGE = -11; 106 const MojoResult MOJO_RESULT_OUT_OF_RANGE = 11;
107 const MojoResult MOJO_RESULT_UNIMPLEMENTED = -12; 107 const MojoResult MOJO_RESULT_UNIMPLEMENTED = 12;
108 const MojoResult MOJO_RESULT_INTERNAL = -13; 108 const MojoResult MOJO_RESULT_INTERNAL = 13;
109 const MojoResult MOJO_RESULT_UNAVAILABLE = -14; 109 const MojoResult MOJO_RESULT_UNAVAILABLE = 14;
110 const MojoResult MOJO_RESULT_DATA_LOSS = -15; 110 const MojoResult MOJO_RESULT_DATA_LOSS = 15;
111 const MojoResult MOJO_RESULT_BUSY = -16; 111 const MojoResult MOJO_RESULT_BUSY = 16;
112 const MojoResult MOJO_RESULT_SHOULD_WAIT = -17; 112 const MojoResult MOJO_RESULT_SHOULD_WAIT = 17;
113 #else 113 #else
114 #define MOJO_RESULT_OK ((MojoResult)0) 114 #define MOJO_RESULT_OK ((MojoResult)0)
115 #define MOJO_RESULT_CANCELLED ((MojoResult) - 1) 115 #define MOJO_RESULT_CANCELLED ((MojoResult)1)
116 #define MOJO_RESULT_UNKNOWN ((MojoResult) - 2) 116 #define MOJO_RESULT_UNKNOWN ((MojoResult)2)
117 #define MOJO_RESULT_INVALID_ARGUMENT ((MojoResult) - 3) 117 #define MOJO_RESULT_INVALID_ARGUMENT ((MojoResult)3)
118 #define MOJO_RESULT_DEADLINE_EXCEEDED ((MojoResult) - 4) 118 #define MOJO_RESULT_DEADLINE_EXCEEDED ((MojoResult)4)
119 #define MOJO_RESULT_NOT_FOUND ((MojoResult) - 5) 119 #define MOJO_RESULT_NOT_FOUND ((MojoResult)5)
120 #define MOJO_RESULT_ALREADY_EXISTS ((MojoResult) - 6) 120 #define MOJO_RESULT_ALREADY_EXISTS ((MojoResult)6)
121 #define MOJO_RESULT_PERMISSION_DENIED ((MojoResult) - 7) 121 #define MOJO_RESULT_PERMISSION_DENIED ((MojoResult)7)
122 #define MOJO_RESULT_RESOURCE_EXHAUSTED ((MojoResult) - 8) 122 #define MOJO_RESULT_RESOURCE_EXHAUSTED ((MojoResult)8)
123 #define MOJO_RESULT_FAILED_PRECONDITION ((MojoResult) - 9) 123 #define MOJO_RESULT_FAILED_PRECONDITION ((MojoResult)9)
124 #define MOJO_RESULT_ABORTED ((MojoResult) - 10) 124 #define MOJO_RESULT_ABORTED ((MojoResult)10)
125 #define MOJO_RESULT_OUT_OF_RANGE ((MojoResult) - 11) 125 #define MOJO_RESULT_OUT_OF_RANGE ((MojoResult)11)
126 #define MOJO_RESULT_UNIMPLEMENTED ((MojoResult) - 12) 126 #define MOJO_RESULT_UNIMPLEMENTED ((MojoResult)12)
127 #define MOJO_RESULT_INTERNAL ((MojoResult) - 13) 127 #define MOJO_RESULT_INTERNAL ((MojoResult)13)
128 #define MOJO_RESULT_UNAVAILABLE ((MojoResult) - 14) 128 #define MOJO_RESULT_UNAVAILABLE ((MojoResult)14)
129 #define MOJO_RESULT_DATA_LOSS ((MojoResult) - 15) 129 #define MOJO_RESULT_DATA_LOSS ((MojoResult)15)
130 #define MOJO_RESULT_BUSY ((MojoResult) - 16) 130 #define MOJO_RESULT_BUSY ((MojoResult)16)
131 #define MOJO_RESULT_SHOULD_WAIT ((MojoResult) - 17) 131 #define MOJO_RESULT_SHOULD_WAIT ((MojoResult)17)
132 #endif 132 #endif
133 133
134 // |MojoDeadline|: Used to specify deadlines (timeouts), in microseconds (except 134 // |MojoDeadline|: Used to specify deadlines (timeouts), in microseconds (except
135 // for |MOJO_DEADLINE_INDEFINITE|). 135 // for |MOJO_DEADLINE_INDEFINITE|).
136 // |MOJO_DEADLINE_INDEFINITE| - Used to indicate "forever". 136 // |MOJO_DEADLINE_INDEFINITE| - Used to indicate "forever".
137 137
138 typedef uint64_t MojoDeadline; 138 typedef uint64_t MojoDeadline;
139 139
140 #ifdef __cplusplus 140 #ifdef __cplusplus
141 const MojoDeadline MOJO_DEADLINE_INDEFINITE = static_cast<MojoDeadline>(-1); 141 const MojoDeadline MOJO_DEADLINE_INDEFINITE = static_cast<MojoDeadline>(-1);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // 32-bit-aligned. 178 // 32-bit-aligned.
179 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); 179 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment");
180 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { 180 struct MOJO_ALIGNAS(4) MojoHandleSignalsState {
181 MojoHandleSignals satisfied_signals; 181 MojoHandleSignals satisfied_signals;
182 MojoHandleSignals satisfiable_signals; 182 MojoHandleSignals satisfiable_signals;
183 }; 183 };
184 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, 184 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8,
185 "MojoHandleSignalsState has wrong size"); 185 "MojoHandleSignalsState has wrong size");
186 186
187 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ 187 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/dart/src/handle_watcher.dart » ('j') | mojo/services/network/public/interfaces/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698