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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 }; | 47 }; |
48 | 48 |
49 const char* ValidationErrorToString(ValidationError error); | 49 const char* ValidationErrorToString(ValidationError error); |
50 | 50 |
51 void ReportValidationError(ValidationError error, | 51 void ReportValidationError(ValidationError error, |
52 const char* description = NULL); | 52 const char* description = nullptr); |
53 | 53 |
54 // Only used by validation tests and when there is only one thread doing message | 54 // Only used by validation tests and when there is only one thread doing message |
55 // validation. | 55 // validation. |
56 class ValidationErrorObserverForTesting { | 56 class ValidationErrorObserverForTesting { |
57 public: | 57 public: |
58 ValidationErrorObserverForTesting(); | 58 ValidationErrorObserverForTesting(); |
59 ~ValidationErrorObserverForTesting(); | 59 ~ValidationErrorObserverForTesting(); |
60 | 60 |
61 ValidationError last_error() const { return last_error_; } | 61 ValidationError last_error() const { return last_error_; } |
62 void set_last_error(ValidationError error) { last_error_ = error; } | 62 void set_last_error(ValidationError error) { last_error_ = error; } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // | 102 // |
103 // In non-debug build, does nothing (not even compiling |condition|). | 103 // In non-debug build, does nothing (not even compiling |condition|). |
104 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ | 104 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ |
105 condition, error, description) \ | 105 condition, error, description) \ |
106 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ | 106 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ |
107 << "The outgoing message will trigger " \ | 107 << "The outgoing message will trigger " \ |
108 << ValidationErrorToString(error) << " at the receiving side (" \ | 108 << ValidationErrorToString(error) << " at the receiving side (" \ |
109 << description << ")."; | 109 << description << ")."; |
110 | 110 |
111 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ | 111 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ |
OLD | NEW |