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

Unified Diff: mojo/public/cpp/bindings/struct_ptr.h

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/struct_ptr.h
diff --git a/mojo/public/cpp/bindings/struct_ptr.h b/mojo/public/cpp/bindings/struct_ptr.h
index a4e55e758f440cc6288cfe4968a142ff8030ffac..ad77d60b08423ab87b20283a66a7363dbdf7e36d 100644
--- a/mojo/public/cpp/bindings/struct_ptr.h
+++ b/mojo/public/cpp/bindings/struct_ptr.h
@@ -5,10 +5,9 @@
#ifndef MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
#define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_PTR_H_
-#include <assert.h>
-
#include <new>
+#include "mojo/public/cpp/environment/logging.h"
#include "mojo/public/cpp/system/macros.h"
namespace mojo {
@@ -55,11 +54,11 @@ class StructPtr {
bool is_null() const { return ptr_ == NULL; }
Struct& operator*() const {
- assert(ptr_);
+ MOJO_DCHECK(ptr_);
return *ptr_;
}
Struct* operator->() const {
- assert(ptr_);
+ MOJO_DCHECK(ptr_);
return ptr_;
}
Struct* get() const { return ptr_; }
@@ -76,7 +75,10 @@ class StructPtr {
private:
friend class internal::StructHelper<Struct>;
- void Initialize() { assert(!ptr_); ptr_ = new Struct(); }
+ void Initialize() {
+ MOJO_DCHECK(!ptr_);
+ ptr_ = new Struct();
+ }
void Take(StructPtr* other) {
reset();
@@ -116,11 +118,11 @@ class InlinedStructPtr {
bool is_null() const { return is_null_; }
Struct& operator*() const {
- assert(!is_null_);
+ MOJO_DCHECK(!is_null_);
return value_;
}
Struct* operator->() const {
- assert(!is_null_);
+ MOJO_DCHECK(!is_null_);
return &value_;
}
Struct* get() const { return &value_; }
« mojo/public/cpp/bindings/lib/bounds_checker.cc ('K') | « mojo/public/cpp/bindings/string.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698