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

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: Fix test Created 5 years, 10 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/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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698