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 26 matching lines...) Expand all Loading... |
37 VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, | 37 VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, |
38 // An encoded pointer is illegal. | 38 // An encoded pointer is illegal. |
39 VALIDATION_ERROR_ILLEGAL_POINTER, | 39 VALIDATION_ERROR_ILLEGAL_POINTER, |
40 // A non-nullable pointer field is set to null. | 40 // A non-nullable pointer field is set to null. |
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 |
| 48 // lengths. |
| 49 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP |
47 }; | 50 }; |
48 | 51 |
49 const char* ValidationErrorToString(ValidationError error); | 52 const char* ValidationErrorToString(ValidationError error); |
50 | 53 |
51 void ReportValidationError(ValidationError error, | 54 void ReportValidationError(ValidationError error, |
52 const char* description = nullptr); | 55 const char* description = nullptr); |
53 | 56 |
54 // Only used by validation tests and when there is only one thread doing message | 57 // Only used by validation tests and when there is only one thread doing message |
55 // validation. | 58 // validation. |
56 class ValidationErrorObserverForTesting { | 59 class ValidationErrorObserverForTesting { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // | 105 // |
103 // In non-debug build, does nothing (not even compiling |condition|). | 106 // In non-debug build, does nothing (not even compiling |condition|). |
104 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ | 107 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ |
105 condition, error, description) \ | 108 condition, error, description) \ |
106 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ | 109 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ |
107 << "The outgoing message will trigger " \ | 110 << "The outgoing message will trigger " \ |
108 << ValidationErrorToString(error) << " at the receiving side (" \ | 111 << ValidationErrorToString(error) << " at the receiving side (" \ |
109 << description << ")."; | 112 << description << ")."; |
110 | 113 |
111 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 114 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
OLD | NEW |