| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MOJO_PUBLIC_SYSTEM_CORE_H_ | 5 #ifndef MOJO_PUBLIC_SYSTEM_CORE_H_ |
| 6 #define MOJO_PUBLIC_SYSTEM_CORE_H_ | 6 #define MOJO_PUBLIC_SYSTEM_CORE_H_ |
| 7 | 7 |
| 8 // Note: This header should be compilable as C. | 8 // Note: This header should be compilable as C. |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // error is similar to |MOJO_RESULT_FAILED_PRECONDITION|, but is more | 82 // error is similar to |MOJO_RESULT_FAILED_PRECONDITION|, but is more |
| 83 // specific.) | 83 // specific.) |
| 84 // |MOJO_RESULT_UNIMPLEMENTED| - The operation is not implemented, supported, | 84 // |MOJO_RESULT_UNIMPLEMENTED| - The operation is not implemented, supported, |
| 85 // or enabled. | 85 // or enabled. |
| 86 // |MOJO_RESULT_INTERNAL| - Internal error: this should never happen and | 86 // |MOJO_RESULT_INTERNAL| - Internal error: this should never happen and |
| 87 // indicates that some invariant expected by the system has been broken. | 87 // indicates that some invariant expected by the system has been broken. |
| 88 // |MOJO_RESULT_UNAVAILABLE| - The operation is (temporarily) currently | 88 // |MOJO_RESULT_UNAVAILABLE| - The operation is (temporarily) currently |
| 89 // unavailable. The caller may simply retry the operation (possibly with | 89 // unavailable. The caller may simply retry the operation (possibly with |
| 90 // a backoff). | 90 // a backoff). |
| 91 // |MOJO_RESULT_DATA_LOSS| - Unrecoverable data loss or corruption. | 91 // |MOJO_RESULT_DATA_LOSS| - Unrecoverable data loss or corruption. |
| 92 // |MOJO_RESULT_BUSY| - One of the resources involved is currently being used |
| 93 // (possibly on another thread) in a way that prevents the current |
| 94 // operation from proceeding, e.g., if the other operation may result in |
| 95 // the resource being invalidated. |
| 92 // | 96 // |
| 93 // Note that positive values are also available as success codes. | 97 // Note that positive values are also available as success codes. |
| 94 // | 98 // |
| 95 // The codes from |MOJO_RESULT_OK| to |MOJO_RESULT_DATA_LOSS| come from | 99 // The codes from |MOJO_RESULT_OK| to |MOJO_RESULT_DATA_LOSS| come from |
| 96 // Google3's canonical error codes. | 100 // Google3's canonical error codes. |
| 97 #ifdef __cplusplus | 101 #ifdef __cplusplus |
| 98 const MojoResult MOJO_RESULT_OK = 0; | 102 const MojoResult MOJO_RESULT_OK = 0; |
| 99 const MojoResult MOJO_RESULT_CANCELLED = -1; | 103 const MojoResult MOJO_RESULT_CANCELLED = -1; |
| 100 const MojoResult MOJO_RESULT_UNKNOWN = -2; | 104 const MojoResult MOJO_RESULT_UNKNOWN = -2; |
| 101 const MojoResult MOJO_RESULT_INVALID_ARGUMENT = -3; | 105 const MojoResult MOJO_RESULT_INVALID_ARGUMENT = -3; |
| 102 const MojoResult MOJO_RESULT_DEADLINE_EXCEEDED = -4; | 106 const MojoResult MOJO_RESULT_DEADLINE_EXCEEDED = -4; |
| 103 const MojoResult MOJO_RESULT_NOT_FOUND = -5; | 107 const MojoResult MOJO_RESULT_NOT_FOUND = -5; |
| 104 const MojoResult MOJO_RESULT_ALREADY_EXISTS = -6; | 108 const MojoResult MOJO_RESULT_ALREADY_EXISTS = -6; |
| 105 const MojoResult MOJO_RESULT_PERMISSION_DENIED = -7; | 109 const MojoResult MOJO_RESULT_PERMISSION_DENIED = -7; |
| 106 const MojoResult MOJO_RESULT_RESOURCE_EXHAUSTED = -8; | 110 const MojoResult MOJO_RESULT_RESOURCE_EXHAUSTED = -8; |
| 107 const MojoResult MOJO_RESULT_FAILED_PRECONDITION = -9; | 111 const MojoResult MOJO_RESULT_FAILED_PRECONDITION = -9; |
| 108 const MojoResult MOJO_RESULT_ABORTED = -10; | 112 const MojoResult MOJO_RESULT_ABORTED = -10; |
| 109 const MojoResult MOJO_RESULT_OUT_OF_RANGE = -11; | 113 const MojoResult MOJO_RESULT_OUT_OF_RANGE = -11; |
| 110 const MojoResult MOJO_RESULT_UNIMPLEMENTED = -12; | 114 const MojoResult MOJO_RESULT_UNIMPLEMENTED = -12; |
| 111 const MojoResult MOJO_RESULT_INTERNAL = -13; | 115 const MojoResult MOJO_RESULT_INTERNAL = -13; |
| 112 const MojoResult MOJO_RESULT_UNAVAILABLE = -14; | 116 const MojoResult MOJO_RESULT_UNAVAILABLE = -14; |
| 113 const MojoResult MOJO_RESULT_DATA_LOSS = -15; | 117 const MojoResult MOJO_RESULT_DATA_LOSS = -15; |
| 118 const MojoResult MOJO_RESULT_BUSY = -16; |
| 114 #else | 119 #else |
| 115 #define MOJO_RESULT_OK ((MojoResult) 0) | 120 #define MOJO_RESULT_OK ((MojoResult) 0) |
| 116 #define MOJO_RESULT_CANCELLED ((MojoResult) -1) | 121 #define MOJO_RESULT_CANCELLED ((MojoResult) -1) |
| 117 #define MOJO_RESULT_UNKNOWN ((MojoResult) -2) | 122 #define MOJO_RESULT_UNKNOWN ((MojoResult) -2) |
| 118 #define MOJO_RESULT_INVALID_ARGUMENT ((MojoResult) -3) | 123 #define MOJO_RESULT_INVALID_ARGUMENT ((MojoResult) -3) |
| 119 #define MOJO_RESULT_DEADLINE_EXCEEDED ((MojoResult) -4) | 124 #define MOJO_RESULT_DEADLINE_EXCEEDED ((MojoResult) -4) |
| 120 #define MOJO_RESULT_NOT_FOUND ((MojoResult) -5) | 125 #define MOJO_RESULT_NOT_FOUND ((MojoResult) -5) |
| 121 #define MOJO_RESULT_ALREADY_EXISTS ((MojoResult) -6) | 126 #define MOJO_RESULT_ALREADY_EXISTS ((MojoResult) -6) |
| 122 #define MOJO_RESULT_PERMISSION_DENIED ((MojoResult) -7) | 127 #define MOJO_RESULT_PERMISSION_DENIED ((MojoResult) -7) |
| 123 #define MOJO_RESULT_RESOURCE_EXHAUSTED ((MojoResult) -8) | 128 #define MOJO_RESULT_RESOURCE_EXHAUSTED ((MojoResult) -8) |
| 124 #define MOJO_RESULT_FAILED_PRECONDITION ((MojoResult) -9) | 129 #define MOJO_RESULT_FAILED_PRECONDITION ((MojoResult) -9) |
| 125 #define MOJO_RESULT_ABORTED ((MojoResult) -10) | 130 #define MOJO_RESULT_ABORTED ((MojoResult) -10) |
| 126 #define MOJO_RESULT_OUT_OF_RANGE ((MojoResult) -11) | 131 #define MOJO_RESULT_OUT_OF_RANGE ((MojoResult) -11) |
| 127 #define MOJO_RESULT_UNIMPLEMENTED ((MojoResult) -12) | 132 #define MOJO_RESULT_UNIMPLEMENTED ((MojoResult) -12) |
| 128 #define MOJO_RESULT_INTERNAL ((MojoResult) -13) | 133 #define MOJO_RESULT_INTERNAL ((MojoResult) -13) |
| 129 #define MOJO_RESULT_UNAVAILABLE ((MojoResult) -14) | 134 #define MOJO_RESULT_UNAVAILABLE ((MojoResult) -14) |
| 130 #define MOJO_RESULT_DATA_LOSS ((MojoResult) -15) | 135 #define MOJO_RESULT_DATA_LOSS ((MojoResult) -15) |
| 136 #define MOJO_RESULT_BUSY ((MojoResult) -16) |
| 131 #endif | 137 #endif |
| 132 | 138 |
| 133 // |MojoDeadline|: | 139 // |MojoDeadline|: |
| 134 // |MOJO_DEADLINE_INDEFINITE| | 140 // |MOJO_DEADLINE_INDEFINITE| |
| 135 #ifdef __cplusplus | 141 #ifdef __cplusplus |
| 136 const MojoDeadline MOJO_DEADLINE_INDEFINITE = static_cast<MojoDeadline>(-1); | 142 const MojoDeadline MOJO_DEADLINE_INDEFINITE = static_cast<MojoDeadline>(-1); |
| 137 #else | 143 #else |
| 138 #define MOJO_DEADLINE_INDEFINITE = ((MojoDeadline) -1); | 144 #define MOJO_DEADLINE_INDEFINITE = ((MojoDeadline) -1); |
| 139 #endif | 145 #endif |
| 140 | 146 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 return MojoReadMessage(handle.value, | 313 return MojoReadMessage(handle.value, |
| 308 bytes, num_bytes, | 314 bytes, num_bytes, |
| 309 &handles[0].value, num_handles, | 315 &handles[0].value, num_handles, |
| 310 flags); | 316 flags); |
| 311 } | 317 } |
| 312 | 318 |
| 313 } // namespace mojo | 319 } // namespace mojo |
| 314 #endif | 320 #endif |
| 315 | 321 |
| 316 #endif // MOJO_PUBLIC_SYSTEM_CORE_H_ | 322 #endif // MOJO_PUBLIC_SYSTEM_CORE_H_ |
| OLD | NEW |