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

Unified Diff: base/memory/scoped_ptr.h

Issue 1305973011: Change assert() to DCHECK() in scoped_ptr.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add //base dependencies as experiment Created 5 years, 3 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 | « no previous file | base/memory/scoped_ptr_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/scoped_ptr.h
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
index 987ccfa804eadde2f89b1ac904ee77bd47b16d36..04a1eb6de4f2cab9f97aec1ad0db336cd9ab7167 100644
--- a/base/memory/scoped_ptr.h
+++ b/base/memory/scoped_ptr.h
@@ -80,7 +80,6 @@
// This is an implementation designed to match the anticipated future TR2
// implementation of the scoped_ptr class.
-#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
@@ -89,6 +88,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
#include "base/move.h"
#include "base/template_util.h"
@@ -226,7 +226,7 @@ class scoped_ptr_impl {
void reset(T* p) {
// This is a self-reset, which is no longer allowed for default deleters:
// https://crbug.com/162971
- assert(!ShouldAbortOnSelfReset<D>::value || p == nullptr || p != data_.ptr);
+ DCHECK(!ShouldAbortOnSelfReset<D>::value || p == nullptr || p != data_.ptr);
// Note that running data_.ptr = p can lead to undefined behavior if
// get_deleter()(get()) deletes this. In order to prevent this, reset()
@@ -377,13 +377,13 @@ class scoped_ptr {
void reset(element_type* p = nullptr) { impl_.reset(p); }
// Accessors to get the owned object.
- // operator* and operator-> will assert() if there is no current object.
+ // operator* and operator-> will DCHECK() if there is no current object.
element_type& operator*() const {
- assert(impl_.get() != nullptr);
+ DCHECK(impl_.get() != nullptr);
return *impl_.get();
}
element_type* operator->() const {
- assert(impl_.get() != nullptr);
+ DCHECK(impl_.get() != nullptr);
return impl_.get();
}
element_type* get() const { return impl_.get(); }
@@ -495,7 +495,7 @@ class scoped_ptr<T[], D> {
// Accessors to get the owned array.
element_type& operator[](size_t i) const {
- assert(impl_.get() != nullptr);
+ DCHECK(impl_.get() != nullptr);
return impl_.get()[i];
}
element_type* get() const { return impl_.get(); }
« no previous file with comments | « no previous file | base/memory/scoped_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698