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

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

Issue 921223002: Cpp bindings: Return false from Validator::Accept() on unrecognized message or invalid flags (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 8 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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 // The |name| field in a message header contains an unexpected value.
48 VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD,
47 // Two parallel arrays which are supposed to represent a map have different 49 // Two parallel arrays which are supposed to represent a map have different
48 // lengths. 50 // lengths.
49 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP, 51 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP,
50 // Attempted to deserialize a tagged union with an unknown tag. 52 // Attempted to deserialize a tagged union with an unknown tag.
51 VALIDATION_ERROR_UNKNOWN_UNION_TAG 53 VALIDATION_ERROR_UNKNOWN_UNION_TAG
52 }; 54 };
53 55
54 const char* ValidationErrorToString(ValidationError error); 56 const char* ValidationErrorToString(ValidationError error);
55 57
56 void ReportValidationError(ValidationError error, 58 void ReportValidationError(ValidationError error,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // 109 //
108 // In non-debug build, does nothing (not even compiling |condition|). 110 // In non-debug build, does nothing (not even compiling |condition|).
109 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ 111 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \
110 condition, error, description) \ 112 condition, error, description) \
111 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ 113 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \
112 << "The outgoing message will trigger " \ 114 << "The outgoing message will trigger " \
113 << ValidationErrorToString(error) << " at the receiving side (" \ 115 << ValidationErrorToString(error) << " at the receiving side (" \
114 << description << ")."; 116 << description << ").";
115 117
116 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 118 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698