OLD | NEW |
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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
7 | 7 |
8 #include "mojo/public/cpp/system/macros.h" | 8 #include "mojo/public/cpp/system/macros.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 30 matching lines...) Expand all Loading... |
41 VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, | 41 VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
42 // |flags| in the message header is an invalid flag combination. | 42 // |flags| in the message header is an invalid flag combination. |
43 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION, | 43 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION, |
44 // |flags| in the message header indicates that a request ID is required but | 44 // |flags| in the message header indicates that a request ID is required but |
45 // there isn't one. | 45 // there isn't one. |
46 VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID, | 46 VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID, |
47 // Two parallel arrays which are supposed to represent a map have different | 47 // Two parallel arrays which are supposed to represent a map have different |
48 // lengths. | 48 // lengths. |
49 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP, | 49 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP, |
50 // Attempted to deserialize a tagged union with an unknown tag. | 50 // Attempted to deserialize a tagged union with an unknown tag. |
51 VALIDATION_ERROR_UNKOWN_UNION_TAG | 51 VALIDATION_ERROR_UNKOWN_UNION_TAG, |
| 52 // The |name| field in a message header contains an unexpected value. |
| 53 VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD |
52 }; | 54 }; |
53 | 55 |
54 const char* ValidationErrorToString(ValidationError error); | 56 const char* ValidationErrorToString(ValidationError error); |
55 | 57 |
56 void ReportValidationError(ValidationError error, | 58 void ReportValidationError(ValidationError error, |
57 const char* description = nullptr); | 59 const char* description = nullptr); |
58 | 60 |
59 // Only used by validation tests and when there is only one thread doing message | 61 // Only used by validation tests and when there is only one thread doing message |
60 // validation. | 62 // validation. |
61 class ValidationErrorObserverForTesting { | 63 class ValidationErrorObserverForTesting { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // | 109 // |
108 // In non-debug build, does nothing (not even compiling |condition|). | 110 // In non-debug build, does nothing (not even compiling |condition|). |
109 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ | 111 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ |
110 condition, error, description) \ | 112 condition, error, description) \ |
111 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ | 113 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ |
112 << "The outgoing message will trigger " \ | 114 << "The outgoing message will trigger " \ |
113 << ValidationErrorToString(error) << " at the receiving side (" \ | 115 << ValidationErrorToString(error) << " at the receiving side (" \ |
114 << description << ")."; | 116 << description << ")."; |
115 | 117 |
116 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 118 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
OLD | NEW |