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 <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 MESSAGE_HEADER_UNKNOWN_METHOD, | 56 MESSAGE_HEADER_UNKNOWN_METHOD, |
57 // Two parallel arrays which are supposed to represent a map have different | 57 // Two parallel arrays which are supposed to represent a map have different |
58 // lengths. | 58 // lengths. |
59 DIFFERENT_SIZED_ARRAYS_IN_MAP, | 59 DIFFERENT_SIZED_ARRAYS_IN_MAP, |
60 // A non-nullable union is set to null. (Has size 0) | 60 // A non-nullable union is set to null. (Has size 0) |
61 UNEXPECTED_NULL_UNION, | 61 UNEXPECTED_NULL_UNION, |
62 }; | 62 }; |
63 | 63 |
64 const char* ValidationErrorToString(ValidationError error); | 64 const char* ValidationErrorToString(ValidationError error); |
65 | 65 |
| 66 // TODO(vardhan): This can die, along with |ValidationErrorObserverForTesting|. |
66 void ReportValidationError(ValidationError error, | 67 void ReportValidationError(ValidationError error, |
67 std::string* description = nullptr); | 68 std::string* description = nullptr); |
68 | 69 |
69 // Only used by validation tests and when there is only one thread doing message | 70 // Only used by validation tests and when there is only one thread doing message |
70 // validation. | 71 // validation. |
71 class ValidationErrorObserverForTesting { | 72 class ValidationErrorObserverForTesting { |
72 public: | 73 public: |
73 ValidationErrorObserverForTesting(); | 74 ValidationErrorObserverForTesting(); |
74 ~ValidationErrorObserverForTesting(); | 75 ~ValidationErrorObserverForTesting(); |
75 | 76 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #define MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err_msg) \ | 119 #define MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err_msg) \ |
119 true ? (void)0 \ | 120 true ? (void)0 \ |
120 : ::mojo::internal::VoidifyOstream() & \ | 121 : ::mojo::internal::VoidifyOstream() & \ |
121 ::mojo::internal::ValidationErrorStringStream(err_msg).stream() | 122 ::mojo::internal::ValidationErrorStringStream(err_msg).stream() |
122 #else | 123 #else |
123 #define MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err_msg) \ | 124 #define MOJO_INTERNAL_DEBUG_SET_ERROR_MSG(err_msg) \ |
124 ::mojo::internal::ValidationErrorStringStream(err_msg).stream() | 125 ::mojo::internal::ValidationErrorStringStream(err_msg).stream() |
125 #endif // NDEBUG | 126 #endif // NDEBUG |
126 | 127 |
127 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 128 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
OLD | NEW |