Chromium Code Reviews| 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 VALIDATION_ERROR_UNKOWN_METHOD | |
|
yzshen1
2015/02/23 19:08:02
Please add comments.
rudominer
2015/03/03 01:54:35
Done.
| |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 const char* ValidationErrorToString(ValidationError error); | 55 const char* ValidationErrorToString(ValidationError error); |
| 55 | 56 |
| 56 void ReportValidationError(ValidationError error, | 57 void ReportValidationError(ValidationError error, |
| 57 const char* description = nullptr); | 58 const char* description = nullptr); |
| 58 | 59 |
| 59 // Only used by validation tests and when there is only one thread doing message | 60 // Only used by validation tests and when there is only one thread doing message |
| 60 // validation. | 61 // validation. |
| 61 class ValidationErrorObserverForTesting { | 62 class ValidationErrorObserverForTesting { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 // | 108 // |
| 108 // In non-debug build, does nothing (not even compiling |condition|). | 109 // In non-debug build, does nothing (not even compiling |condition|). |
| 109 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ | 110 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ |
| 110 condition, error, description) \ | 111 condition, error, description) \ |
| 111 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ | 112 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ |
| 112 << "The outgoing message will trigger " \ | 113 << "The outgoing message will trigger " \ |
| 113 << ValidationErrorToString(error) << " at the receiving side (" \ | 114 << ValidationErrorToString(error) << " at the receiving side (" \ |
| 114 << description << ")."; | 115 << description << ")."; |
| 115 | 116 |
| 116 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 117 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
| OLD | NEW |