Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: mojo/public/cpp/bindings/lib/validation_errors.h

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bindings/callback.h" 8 #include "mojo/public/cpp/bindings/callback.h"
9 #include "mojo/public/cpp/system/macros.h" 9 #include "mojo/public/cpp/system/macros.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS, 52 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS,
53 // |flags| in the message header indicates that a request ID is required but 53 // |flags| in the message header indicates that a request ID is required but
54 // there isn't one. 54 // there isn't one.
55 VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID, 55 VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID,
56 // The |name| field in a message header contains an unexpected value. 56 // The |name| field in a message header contains an unexpected value.
57 VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD, 57 VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD,
58 // Two parallel arrays which are supposed to represent a map have different 58 // Two parallel arrays which are supposed to represent a map have different
59 // lengths. 59 // lengths.
60 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP, 60 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP,
61 // Attempted to deserialize a tagged union with an unknown tag. 61 // Attempted to deserialize a tagged union with an unknown tag.
62 VALIDATION_ERROR_UNKNOWN_UNION_TAG 62 VALIDATION_ERROR_UNKNOWN_UNION_TAG,
63 // A value of a non-extensible enum type is unknown.
64 VALIDATION_ERROR_UNKNOWN_ENUM_VALUE
63 }; 65 };
64 66
65 const char* ValidationErrorToString(ValidationError error); 67 const char* ValidationErrorToString(ValidationError error);
66 68
67 void ReportValidationError(ValidationError error, 69 void ReportValidationError(ValidationError error,
68 const char* description = nullptr); 70 const char* description = nullptr);
69 71
70 // Only used by validation tests and when there is only one thread doing message 72 // Only used by validation tests and when there is only one thread doing message
71 // validation. 73 // validation.
72 class ValidationErrorObserverForTesting { 74 class ValidationErrorObserverForTesting {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // 124 //
123 // In non-debug build, does nothing (not even compiling |condition|). 125 // In non-debug build, does nothing (not even compiling |condition|).
124 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ 126 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \
125 condition, error, description) \ 127 condition, error, description) \
126 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ 128 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \
127 << "The outgoing message will trigger " \ 129 << "The outgoing message will trigger " \
128 << ValidationErrorToString(error) << " at the receiving side (" \ 130 << ValidationErrorToString(error) << " at the receiving side (" \
129 << description << ")."; 131 << description << ").";
130 132
131 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 133 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/template_util.h ('k') | mojo/public/cpp/bindings/lib/validation_errors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698