diff options
Diffstat (limited to 'mojo/public/cpp/bindings/lib/validation_errors.h')
-rw-r--r-- | mojo/public/cpp/bindings/lib/validation_errors.h | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/mojo/public/cpp/bindings/lib/validation_errors.h b/mojo/public/cpp/bindings/lib/validation_errors.h index 122418d..ec0aa27 100644 --- a/mojo/public/cpp/bindings/lib/validation_errors.h +++ b/mojo/public/cpp/bindings/lib/validation_errors.h @@ -8,13 +8,9 @@ #include "base/callback.h" #include "base/logging.h" #include "base/macros.h" -#include "mojo/public/cpp/bindings/bindings_export.h" #include "mojo/public/cpp/bindings/lib/validation_context.h" namespace mojo { - -class Message; - namespace internal { enum ValidationError { @@ -71,41 +67,17 @@ enum ValidationError { // Message deserialization failure, for example due to rejection by custom // validation logic. VALIDATION_ERROR_DESERIALIZATION_FAILED, - // The message contains a too deeply nested value, for example a recursively - // defined field which runtime value is too large. - VALIDATION_ERROR_MAX_RECURSION_DEPTH, }; -MOJO_CPP_BINDINGS_EXPORT const char* ValidationErrorToString( - ValidationError error); - -MOJO_CPP_BINDINGS_EXPORT void ReportValidationError( - ValidationContext* context, - ValidationError error, - const char* description = nullptr); +const char* ValidationErrorToString(ValidationError error); -MOJO_CPP_BINDINGS_EXPORT void ReportValidationErrorForMessage( - mojo::Message* message, - ValidationError error, - const char* description = nullptr); - -// This class may be used by tests to suppress validation error logging. This is -// not thread-safe and must only be instantiated on the main thread with no -// other threads using Mojo bindings at the time of construction or destruction. -class MOJO_CPP_BINDINGS_EXPORT ScopedSuppressValidationErrorLoggingForTests { - public: - ScopedSuppressValidationErrorLoggingForTests(); - ~ScopedSuppressValidationErrorLoggingForTests(); - - private: - const bool was_suppressed_; - - DISALLOW_COPY_AND_ASSIGN(ScopedSuppressValidationErrorLoggingForTests); -}; +void ReportValidationError(ValidationContext* context, + ValidationError error, + const char* description = nullptr); // Only used by validation tests and when there is only one thread doing message // validation. -class MOJO_CPP_BINDINGS_EXPORT ValidationErrorObserverForTesting { +class ValidationErrorObserverForTesting { public: explicit ValidationErrorObserverForTesting(const base::Closure& callback); ~ValidationErrorObserverForTesting(); @@ -127,11 +99,11 @@ class MOJO_CPP_BINDINGS_EXPORT ValidationErrorObserverForTesting { // // The function returns true if the error is recorded (by a // SerializationWarningObserverForTesting object), false otherwise. -MOJO_CPP_BINDINGS_EXPORT bool ReportSerializationWarning(ValidationError error); +bool ReportSerializationWarning(ValidationError error); // Only used by serialization tests and when there is only one thread doing // message serialization. -class MOJO_CPP_BINDINGS_EXPORT SerializationWarningObserverForTesting { +class SerializationWarningObserverForTesting { public: SerializationWarningObserverForTesting(); ~SerializationWarningObserverForTesting(); |