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

Unified Diff: mojo/public/cpp/bindings/lib/array_serialization.h

Issue 473793004: Mojo C++ bindings: better log message for serialization warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/array_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h
index 492de788b4530f4997101b8772cd864958e1845b..cce60fdc829503c6c23830ebc5b3ccf9d03edbd8 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -104,7 +104,8 @@ template <typename H> struct ArraySerializer<ScopedHandleBase<H>, H, true> {
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
IsNonNullableValidationEnabled() && !element_is_nullable &&
!output->at(i).is_valid(),
- VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE);
+ VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
+ "invalid handle in array of non-nullable handles");
}
}
static void DeserializeElements(
@@ -135,7 +136,8 @@ template <typename S> struct ArraySerializer<S, typename S::Data_*, true> {
output->at(i) = element;
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
IsNonNullableValidationEnabled() && !element_is_nullable && !element,
- VALIDATION_ERROR_UNEXPECTED_NULL_POINTER);
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ "null pointer in array of non-nullable pointers");
hansmuller 2014/08/21 00:26:40 You could specify the element index in the error m
yzshen1 2014/08/21 05:57:49 Done.
}
}
static void DeserializeElements(
@@ -194,7 +196,8 @@ template <> struct ArraySerializer<String, String_Data*, false> {
output->at(i) = element;
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
IsNonNullableValidationEnabled() && !element_is_nullable && !element,
- VALIDATION_ERROR_UNEXPECTED_NULL_POINTER);
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ "null string in array of non-nullable strings");
}
}
static void DeserializeElements(
@@ -223,7 +226,8 @@ inline void SerializeArray_(Array<E> input, internal::Buffer* buf,
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
ValidateParams::expected_num_elements != 0 &&
input.size() != ValidateParams::expected_num_elements,
- internal::VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER);
+ internal::VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER,
+ "fixed-size array has wrong number of elements");
internal::Array_Data<F>* result =
internal::Array_Data<F>::New(input.size(), buf);
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | mojo/public/cpp/bindings/lib/validation_errors.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698