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

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
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.cc ('k') | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2c399c897abd3dfb33d5aa8fe124faf7d50e8ad3..fc62a88d57fe8883973a4625ff16741478ebd84a 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -103,7 +103,10 @@ template <typename H> struct ArraySerializer<ScopedHandleBase<H>, H, true> {
output->at(i) = input[i].release(); // Transfer ownership of the handle.
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
!element_is_nullable && !output->at(i).is_valid(),
- VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE);
+ VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
+ MakeMessageWithArrayIndex(
+ "invalid handle in array expecting valid handles",
+ input.size(), i));
}
}
static void DeserializeElements(
@@ -134,7 +137,9 @@ template <typename S> struct ArraySerializer<S, typename S::Data_*, true> {
output->at(i) = element;
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
!element_is_nullable && !element,
- VALIDATION_ERROR_UNEXPECTED_NULL_POINTER);
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ MakeMessageWithArrayIndex(
+ "null in array expecting valid pointers", input.size(), i));
}
}
static void DeserializeElements(
@@ -193,7 +198,9 @@ template <> struct ArraySerializer<String, String_Data*, false> {
output->at(i) = element;
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
!element_is_nullable && !element,
- VALIDATION_ERROR_UNEXPECTED_NULL_POINTER);
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ MakeMessageWithArrayIndex(
+ "null in array expecting valid strings", input.size(), i));
}
}
static void DeserializeElements(
@@ -222,7 +229,10 @@ 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,
+ internal::MakeMessageWithExpectedArraySize(
+ "fixed-size array has wrong number of elements",
+ input.size(), ValidateParams::expected_num_elements));
internal::Array_Data<F>* result =
internal::Array_Data<F>::New(input.size(), buf);
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.cc ('k') | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698