Chromium Code Reviews| 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" |
|
danakj
2015/09/03 17:16:27
This will include logging in a lot of places. Does
|
| #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(); } |