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

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

Issue 494943004: Mojo C++ bindings: better log messages for some validation errors at the receiver side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
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 }; 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 53
53 // 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
54 // validation. 55 // validation.
55 class ValidationErrorObserverForTesting { 56 class ValidationErrorObserverForTesting {
56 public: 57 public:
57 ValidationErrorObserverForTesting(); 58 ValidationErrorObserverForTesting();
58 ~ValidationErrorObserverForTesting(); 59 ~ValidationErrorObserverForTesting();
59 60
60 ValidationError last_error() const { return last_error_; } 61 ValidationError last_error() const { return last_error_; }
61 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
101 // 102 //
102 // In non-debug build, does nothing (not even compiling |condition|). 103 // In non-debug build, does nothing (not even compiling |condition|).
103 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \ 104 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( \
104 condition, error, description) \ 105 condition, error, description) \
105 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ 106 MOJO_DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \
106 << "The outgoing message will trigger " \ 107 << "The outgoing message will trigger " \
107 << ValidationErrorToString(error) << " at the receiving side (" \ 108 << ValidationErrorToString(error) << " at the receiving side (" \
108 << description << ")."; 109 << description << ").";
109 110
110 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 111 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.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