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

Unified Diff: mojo/public/cpp/bindings/lib/bindings_serialization.cc

Issue 399313007: Mojo: Convert assert()s under mojo/public/cpp/bindings/... to MOJO_DCHECK()s. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/bindings_serialization.cc
diff --git a/mojo/public/cpp/bindings/lib/bindings_serialization.cc b/mojo/public/cpp/bindings/lib/bindings_serialization.cc
index d5f778536847173015d3326b625750bacf72e29b..53fd61645ab720746087ea320cc69c16d1d4cee4 100644
--- a/mojo/public/cpp/bindings/lib/bindings_serialization.cc
+++ b/mojo/public/cpp/bindings/lib/bindings_serialization.cc
@@ -4,11 +4,10 @@
#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include <assert.h>
-
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/bounds_checker.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
+#include "mojo/public/cpp/environment/logging.h"
namespace mojo {
namespace internal {
@@ -44,7 +43,7 @@ void EncodePointer(const void* ptr, uint64_t* offset) {
const char* p_obj = reinterpret_cast<const char*>(ptr);
const char* p_slot = reinterpret_cast<const char*>(offset);
- assert(p_obj > p_slot);
+ MOJO_DCHECK(p_obj > p_slot);
*offset = static_cast<uint64_t>(p_obj - p_slot);
}
@@ -75,7 +74,7 @@ void DecodeHandle(Handle* handle, std::vector<Handle>* handles) {
*handle = Handle();
return;
}
- assert(handle->value() < handles->size());
+ MOJO_DCHECK(handle->value() < handles->size());
// Just leave holes in the vector so we don't screw up other indices.
*handle = FetchAndReset(&handles->at(handle->value()));
}
@@ -84,7 +83,7 @@ bool ValidateStructHeader(const void* data,
uint32_t min_num_bytes,
uint32_t min_num_fields,
BoundsChecker* bounds_checker) {
- assert(min_num_bytes >= sizeof(StructHeader));
+ MOJO_DCHECK(min_num_bytes >= sizeof(StructHeader));
if (!IsAligned(data)) {
ReportValidationError(VALIDATION_ERROR_MISALIGNED_OBJECT);

Powered by Google App Engine
This is Rietveld 408576698