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

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

Issue 1755003002: Remove MOJO_DISALLOW_COPY_AND_ASSIGN and MOJO_ALLOW_UNUSED_LOCAL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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 | « mojo/public/cpp/bindings/lib/validate_params.h ('k') | mojo/public/cpp/bindings/message.h » ('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 "base/logging.h" 8 #include "base/logging.h"
9 #include "mojo/public/cpp/bindings/callback.h" 9 #include "mojo/public/cpp/bindings/callback.h"
10 #include "mojo/public/cpp/system/macros.h" 10 #include "mojo/public/cpp/system/macros.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 ValidationError last_error() const { return last_error_; } 80 ValidationError last_error() const { return last_error_; }
81 void set_last_error(ValidationError error) { 81 void set_last_error(ValidationError error) {
82 last_error_ = error; 82 last_error_ = error;
83 callback_.Run(); 83 callback_.Run();
84 } 84 }
85 85
86 private: 86 private:
87 ValidationError last_error_; 87 ValidationError last_error_;
88 Callback<void()> callback_; 88 Callback<void()> callback_;
89 89
90 MOJO_DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting); 90 DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting);
91 }; 91 };
92 92
93 // Used only by MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING. Don't use it directly. 93 // Used only by MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING. Don't use it directly.
94 // 94 //
95 // The function returns true if the error is recorded (by a 95 // The function returns true if the error is recorded (by a
96 // SerializationWarningObserverForTesting object), false otherwise. 96 // SerializationWarningObserverForTesting object), false otherwise.
97 bool ReportSerializationWarning(ValidationError error); 97 bool ReportSerializationWarning(ValidationError error);
98 98
99 // Only used by serialization tests and when there is only one thread doing 99 // Only used by serialization tests and when there is only one thread doing
100 // message serialization. 100 // message serialization.
101 class SerializationWarningObserverForTesting { 101 class SerializationWarningObserverForTesting {
102 public: 102 public:
103 SerializationWarningObserverForTesting(); 103 SerializationWarningObserverForTesting();
104 ~SerializationWarningObserverForTesting(); 104 ~SerializationWarningObserverForTesting();
105 105
106 ValidationError last_warning() const { return last_warning_; } 106 ValidationError last_warning() const { return last_warning_; }
107 void set_last_warning(ValidationError error) { last_warning_ = error; } 107 void set_last_warning(ValidationError error) { last_warning_ = error; }
108 108
109 private: 109 private:
110 ValidationError last_warning_; 110 ValidationError last_warning_;
111 111
112 MOJO_DISALLOW_COPY_AND_ASSIGN(SerializationWarningObserverForTesting); 112 DISALLOW_COPY_AND_ASSIGN(SerializationWarningObserverForTesting);
113 }; 113 };
114 114
115 } // namespace internal 115 } // namespace internal
116 } // namespace mojo 116 } // namespace mojo
117 117
118 // In debug build, logs a serialization warning if |condition| evaluates to 118 // In debug build, logs a serialization warning if |condition| evaluates to
119 // true: 119 // true:
120 // - if there is a SerializationWarningObserverForTesting object alive, 120 // - if there is a SerializationWarningObserverForTesting object alive,
121 // records |error| in it; 121 // records |error| in it;
122 // - otherwise, logs a fatal-level message. 122 // - otherwise, logs a fatal-level message.
123 // |error| is the validation error that will be triggered by the receiver 123 // |error| is the validation error that will be triggered by the receiver
124 // of the serialzation result. 124 // of the serialzation result.
125 // 125 //
126 // In non-debug build, does nothing (not even compiling |condition|). 126 // In non-debug build, does nothing (not even compiling |condition|).
127 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(condition, error, \ 127 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(condition, error, \
128 description) \ 128 description) \
129 DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ 129 DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \
130 << "The outgoing message will trigger " \ 130 << "The outgoing message will trigger " \
131 << ValidationErrorToString(error) << " at the receiving side (" \ 131 << ValidationErrorToString(error) << " at the receiving side (" \
132 << description << ")."; 132 << description << ").";
133 133
134 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 134 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/validate_params.h ('k') | mojo/public/cpp/bindings/message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698